aboutsummaryrefslogtreecommitdiff
path: root/include/datetime/clock-mock.h
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-01-22 14:28:20 -0600
committerCharles Kerr <charles.kerr@canonical.com>2014-01-22 14:28:20 -0600
commitaad7e86a109aeec75b3772cda20478363f966745 (patch)
tree5049662b13435cc5b422e1194bd617a1089e6fb6 /include/datetime/clock-mock.h
parente2fd6e620ce7f18c2cbf7c7b353d7cb5f86dce11 (diff)
downloadayatana-indicator-datetime-aad7e86a109aeec75b3772cda20478363f966745.tar.gz
ayatana-indicator-datetime-aad7e86a109aeec75b3772cda20478363f966745.tar.bz2
ayatana-indicator-datetime-aad7e86a109aeec75b3772cda20478363f966745.zip
Alarms is going to need to know when the clock's minute changes. We already have a timer for that in Formatter, so move it from there to Clock and add a corresponding public signal Clock.minuteChanged that both Formatter and Alarms can use. Sync unit tests.
Diffstat (limited to 'include/datetime/clock-mock.h')
-rw-r--r--include/datetime/clock-mock.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/datetime/clock-mock.h b/include/datetime/clock-mock.h
index 19a859b..27926ff 100644
--- a/include/datetime/clock-mock.h
+++ b/include/datetime/clock-mock.h
@@ -42,11 +42,11 @@ public:
DateTime localtime() const { return m_localtime; }
void set_localtime(const DateTime& dt) {
- const auto old_day = m_localtime.day_of_year();
+ const auto old = m_localtime;
m_localtime = dt;
- skewDetected();
- const auto new_day = m_localtime.day_of_year();
- if (old_day != new_day)
+ if (!DateTime::is_same_minute(old, m_localtime))
+ minuteChanged();
+ if (!DateTime::is_same_day(old, m_localtime))
dateChanged();
}