[gnome-panel] clock: Do not miss seconds when displaying seconds



commit 20732053fbbb5b7a4b59c8f74a3a79dfca5a45cc
Author: Aryeh Gregor <Simetrical+gnome gmail com>
Date:   Fri Aug 12 13:33:57 2011 +0200

    clock: Do not miss seconds when displaying seconds
    
    The timeout we were using is expecting a 1ms resolution; usually, timers
    have a 10ms, though, so we could sometimes simply skip a second, which
    is bad. Add 15ms to the timeout to avoid that.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=585668

 applets/clock/clock.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index 95a929a..d0922da 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -313,7 +313,10 @@ clock_set_timeout (ClockData *cd,
 		struct tm *tm;
 
 		gettimeofday (&tv, NULL);
- 		timeouttime = (G_USEC_PER_SEC - tv.tv_usec)/1000+1;
+		/* We can't expect the timer resolution to be < 10ms, so add
+		 * 15ms to make sure we're fine; see
+		 * https://bugzilla.gnome.org/show_bug.cgi?id=585668 */
+		timeouttime = (G_USEC_PER_SEC - tv.tv_usec)/1000+15;
 
 		/* timeout of one minute if we don't care about the seconds */
  		if (cd->format != CLOCK_FORMAT_UNIX &&



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