gnome-panel r10990 - trunk/applets/clock



Author: vuntz
Date: Mon Apr  7 14:27:25 2008
New Revision: 10990
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=10990&view=rev

Log:
2008-04-07  Vincent Untz  <vuntz gnome org>

	* clock.c: (set_time): correctly set time, even when DST is on.
	Thanks to Pascal Terjan <pascal terjan free fr> for the hint.
	Should fix bug #525762.


Modified:
   trunk/applets/clock/ChangeLog
   trunk/applets/clock/clock.c

Modified: trunk/applets/clock/clock.c
==============================================================================
--- trunk/applets/clock/clock.c	(original)
+++ trunk/applets/clock/clock.c	Mon Apr  7 14:27:25 2008
@@ -1720,9 +1720,14 @@
 set_time (GtkWidget *widget, ClockData *cd)
 {
 	struct tm t;
-	gint64 time;
+	time_t tim;
 	guint year, month, day;
 
+	time (&tim);
+	/* sets t.isdst -- we could set it to -1 to have mktime() guess the
+	 * right value , but we don't know if this works with all libc */
+	localtime_r (&tim, &t);
+
 	t.tm_sec = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (cd->seconds_spin));
 	t.tm_min = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (cd->minutes_spin));
 	t.tm_hour = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (cd->hours_spin));
@@ -1731,9 +1736,9 @@
 	t.tm_mon = month;
 	t.tm_mday = day;
 
-	time = mktime (&t);
+	tim = mktime (&t);
 
-	set_system_time_async (time, (GFunc)set_time_callback, cd, NULL);
+	set_system_time_async (tim, (GFunc)set_time_callback, cd, NULL);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]