summaryrefslogtreecommitdiff
path: root/src/clock.cpp
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2009-10-26 18:14:06 +0100
committerAndrzej Rybczak <electricityispower@gmail.com>2009-10-26 18:14:06 +0100
commit164d32c0794cb09cab250d02d20ea1d75ece70f2 (patch)
tree920ca76ab1b23c560c077dffcafa1888a6874be6 /src/clock.cpp
parenta91d02e181bab82618e7152316012e7ef61a17f0 (diff)
use one global timer instead of several local ones
Diffstat (limited to 'src/clock.cpp')
-rw-r--r--src/clock.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/clock.cpp b/src/clock.cpp
index 528ebdd0..7268350e 100644
--- a/src/clock.cpp
+++ b/src/clock.cpp
@@ -25,6 +25,7 @@
#ifdef ENABLE_CLOCK
#include <cstring>
+#include <sys/time.h>
#include "global.h"
#include "playlist.h"
@@ -105,13 +106,12 @@ void Clock::Update()
if (Width > size_t(COLS) || Height > MainHeight)
myPlaylist->SwitchTo();
- static time_t now = 0, past;
- time(&past);
- if (past <= now)
+ static timeval past = { 0, 0 };
+ if (Timer.tv_sec <= past.tv_sec)
return;
- time(&now);
+ gettimeofday(&past, 0);
- tm *time = localtime(&now);
+ tm *time = localtime(&past.tv_sec);
mask = 0;
Set(time->tm_sec % 10, 0);