aboutsummaryrefslogtreecommitdiff
path: root/src/wakeup-timer-mainloop.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-06-10 09:00:14 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-06-10 09:00:14 -0500
commit02319cb816824442fa59736f97e570726e01ce41 (patch)
treecdf638791da2d439cc5471aee72685e60471be11 /src/wakeup-timer-mainloop.cpp
parent9213d97f8f7b743f5f59a18c5a71fc96f4dcaed6 (diff)
downloadayatana-indicator-datetime-02319cb816824442fa59736f97e570726e01ce41.tar.gz
ayatana-indicator-datetime-02319cb816824442fa59736f97e570726e01ce41.tar.bz2
ayatana-indicator-datetime-02319cb816824442fa59736f97e570726e01ce41.zip
in wakeup-timer-mainloop, don't just cast to uint without checking sign. (h/t ted)
Diffstat (limited to 'src/wakeup-timer-mainloop.cpp')
-rw-r--r--src/wakeup-timer-mainloop.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wakeup-timer-mainloop.cpp b/src/wakeup-timer-mainloop.cpp
index dfef037..4f99c8c 100644
--- a/src/wakeup-timer-mainloop.cpp
+++ b/src/wakeup-timer-mainloop.cpp
@@ -21,6 +21,8 @@
#include <glib.h>
+#include <cstdlib> // abs()
+
namespace unity {
namespace indicator {
namespace datetime {
@@ -63,7 +65,7 @@ private:
const auto now = m_clock->localtime();
const auto difference_usec = g_date_time_difference(m_wakeup_time.get(), now.get());
- const guint interval_msec = (guint)difference_usec / 1000u;
+ const guint interval_msec = std::abs(difference_usec) / 1000u;
g_debug("%s setting wakeup timer to kick at %s, which is in %zu seconds",
G_STRFUNC,
m_wakeup_time.format("%F %T").c_str(),