[PATCH] Remove rounding of the value for minutes when editing dive date/time

Lubomir I. Ivanov neolit123 at gmail.com
Sun Feb 24 08:29:10 PST 2013


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

For the "Edit dive date/time" dialog, (time->tm_min / 5)*5)
with integers can lose precision due to truncation, showing for example
a value of 55, where 59 is the actual previsouly stored value.

Reported-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn at axis.com>
Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---

there could be an intent to do the rouding explicitly, but i'm not aware why
that may be required.

---
 info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/info.c b/info.c
index 2fe6e47..44026bd 100644
--- a/info.c
+++ b/info.c
@@ -1122,7 +1122,7 @@ GtkWidget *create_date_time_widget(struct tm *time, GtkWidget **cal, GtkWidget *
 	gtk_calendar_select_month(GTK_CALENDAR(*cal), time->tm_mon, time->tm_year + 1900);
 	gtk_calendar_select_day(GTK_CALENDAR(*cal), time->tm_mday);
 	gtk_spin_button_set_value(GTK_SPIN_BUTTON(*h), time->tm_hour);
-	gtk_spin_button_set_value(GTK_SPIN_BUTTON(*m), (time->tm_min / 5)*5);
+	gtk_spin_button_set_value(GTK_SPIN_BUTTON(*m), time->tm_min);
 
 	gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(*h), TRUE);
 	gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(*m), TRUE);
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list