From 02319cb816824442fa59736f97e570726e01ce41 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 10 Jun 2014 09:00:14 -0500 Subject: in wakeup-timer-mainloop, don't just cast to uint without checking sign. (h/t ted) --- src/wakeup-timer-mainloop.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/wakeup-timer-mainloop.cpp') 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 +#include // 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(), -- cgit v1.2.3