From 66a241cc43b53c8a3e7d70b0c929c0d672bd65c7 Mon Sep 17 00:00:00 2001 From: mathias Date: Thu, 30 Jun 2005 08:38:53 +0000 Subject: if we check the time only ever second we can get into trouble, eg: assume its 12:34:56.99, displaying 12:34:56 takes some time and so its already 12:34:57 when we display 12:34:56. to fix that i set the time to check the clock to 0.01 seconds. that shouldnt hurt much since we only redraw the clock when the string has changed. a more complex approach would be to analyze the strftime-string and set the timeout accordingly. but i dont know if its really worth the effort and beeing a bit off schedule can happen too, just not as often as if you are in seconds mode. --- ChangeLog | 3 +++ src/ClockTool.cc | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f42cf2..e2ffea9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 0.9.14: +*05/06/30: + * Fix for clock displaying %S too late sometimes (Mathias) + ClockTool.cc *05/06/28: * Fix for toggling the toolbar doesnt update strut (thanx C. Monti) * Little reordering of ToolbarMenu items (Mathias) diff --git a/src/ClockTool.cc b/src/ClockTool.cc index 709abd8..cf56da7 100644 --- a/src/ClockTool.cc +++ b/src/ClockTool.cc @@ -148,10 +148,11 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent, _FB_USES_NLS; - // setup timer to update the graphics each second + // setup timer to check the clock every 0.01 second + // if nothing has changed, it wont update the graphics timeval delay; - delay.tv_sec = 1; - delay.tv_usec = 0; + delay.tv_sec = 0; + delay.tv_usec = 100000; m_timer.setTimeout(delay); FbTk::RefCount update_graphic(new FbTk::SimpleCommand(*this, &ClockTool::updateTime)); -- cgit v0.11.2