summaryrefslogtreecommitdiff
blob: d76907daae27daa69b2a1bd84aae5594995bfb36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From Fedora Core 6:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=204862
http://cvs.fedora.redhat.com/viewcvs/*checkout*/rpms/gnome-panel/devel/gnome-panel-2.15.92-no-seconds.patch?rev=1.1
http://bugzilla.gnome.org/attachment.cgi?id=72039&action=view

Alternative approach discussion on upstream bug, with possibly better timezone change notification done in the future:
http://bugzilla.gnome.org/show_bug.cgi?id=348749

--- gnome-panel-2.15.92/applets/clock/clock.c.no-seconds	2006-09-01 13:52:10.000000000 -0400
+++ gnome-panel-2.15.92/applets/clock/clock.c	2006-09-01 13:56:36.000000000 -0400
@@ -48,6 +48,7 @@
 #include <string.h>
 #include <time.h>
 #include <langinfo.h>
+#include <sys/time.h>
 
 #include <panel-applet.h>
 #include <panel-applet-gconf.h>
@@ -243,6 +244,7 @@
 {
 	ClockData *cd = data;
 	time_t new_time;
+	int timeouttime;
 
         time (&new_time);
 
@@ -262,7 +264,20 @@
 		update_clock (cd);
 	}
 
-	return TRUE;
+	if (cd->format == CLOCK_FORMAT_INTERNET)
+		timeouttime = INTERNETSECOND;
+	else {
+		struct timeval tv;
+		gettimeofday(&tv, NULL);
+		timeouttime = (1000000 - tv.tv_usec)/1000+1;
+		if (!cd->showseconds)
+			timeouttime += 1000 * (59 - cd->current_time % 60);
+	}
+        cd->timeout = g_timeout_add (timeouttime,
+				     clock_timeout_callback,
+                                     cd);
+
+	return FALSE;
 }
 
 static float
@@ -489,8 +504,13 @@
 	
 	if (cd->format == CLOCK_FORMAT_INTERNET)
 		timeouttime = INTERNETSECOND;
-	else
-		timeouttime = 1000;
+ 	else {
+ 		struct timeval tv;
+		gettimeofday(&tv, NULL);
+ 		timeouttime = (1000000 - tv.tv_usec)/1000+1;
+ 		if (!cd->showseconds)
+ 			timeouttime += 1000 * (59 - cd->current_time % 60);
+ 	}
 	
 	cd->timeout = g_timeout_add (timeouttime,
 	                             clock_timeout_callback,