aboutsummaryrefslogtreecommitdiff
path: root/src/ClockTool.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/ClockTool.cc')
-rw-r--r--src/ClockTool.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ClockTool.cc b/src/ClockTool.cc
index 514d45d..f11a793 100644
--- a/src/ClockTool.cc
+++ b/src/ClockTool.cc
@@ -52,10 +52,19 @@ const char SWITCHES_12_24H[] = "lIrkHT";
52const char SWITCHES_24_12H[] = "kHTlIr"; 52const char SWITCHES_24_12H[] = "kHTlIr";
53const char SWITCH_AM_PM[] = "pP"; 53const char SWITCH_AM_PM[] = "pP";
54 54
55uint64_t calcNextTimeout() { 55int showSeconds(const std::string& fmt) {
56
57 return FbTk::StringUtil::findCharFromAlphabetAfterTrigger(
58 fmt, '%', SWITCHES_SECONDS, sizeof(SWITCHES_SECONDS), 0) != std::string::npos;
59}
60
61uint64_t calcNextTimeout(const std::string& fmt) {
56 62
57 uint64_t now = FbTk::FbTime::system(); 63 uint64_t now = FbTk::FbTime::system();
58 uint64_t unit = FbTk::FbTime::IN_SECONDS; 64 uint64_t unit = FbTk::FbTime::IN_SECONDS;
65 if (!showSeconds(fmt)) { // microseconds till next full minute
66 unit *= 60L;
67 }
59 return FbTk::FbTime::remainingNext(now, unit); 68 return FbTk::FbTime::remainingNext(now, unit);
60} 69}
61 70
@@ -289,8 +298,7 @@ void ClockTool::updateTime() {
289 } 298 }
290 299
291restart_timer: 300restart_timer:
292 m_timer.setTimeout(calcNextTimeout()); 301 m_timer.setTimeout(calcNextTimeout(*m_timeformat), true);
293 m_timer.start();
294} 302}
295 303
296// Just change things that affect the size 304// Just change things that affect the size