diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2015-03-17 15:23:49 +0000 |
---|---|---|
committer | CI Train Bot <ci-train-bot@canonical.com> | 2015-03-17 15:23:49 +0000 |
commit | ddde67df581dea8c5a261e43d5b12a3821f06ed1 (patch) | |
tree | e3c2859c54b0bba9c72ad221ea41c95ed8f5a70f /include/datetime/date-time.h | |
parent | 15ec7f61fa84a9a8b40c1c9fcfa6c2a268d3232b (diff) | |
parent | 273c3b3829c9a3e853d0b6b0a32ae87cc3c6852b (diff) | |
download | ayatana-indicator-datetime-ddde67df581dea8c5a261e43d5b12a3821f06ed1.tar.gz ayatana-indicator-datetime-ddde67df581dea8c5a261e43d5b12a3821f06ed1.tar.bz2 ayatana-indicator-datetime-ddde67df581dea8c5a261e43d5b12a3821f06ed1.zip |
Fix bug that prevented clicking on calendar days where DST sprang forward. Fixes: #1429388
Approved by: Ted Gould, PS Jenkins bot
Diffstat (limited to 'include/datetime/date-time.h')
-rw-r--r-- | include/datetime/date-time.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/include/datetime/date-time.h b/include/datetime/date-time.h index 4be35f7..7dfc207 100644 --- a/include/datetime/date-time.h +++ b/include/datetime/date-time.h @@ -36,15 +36,21 @@ class DateTime { public: static DateTime NowLocal(); - static DateTime Local(int years, int months, int days, int hours, int minutes, int seconds); + static DateTime Local(int year, int month, int day, int hour, int minute, double seconds); + DateTime(); explicit DateTime(time_t t); - explicit DateTime(GDateTime* in=nullptr); - DateTime& operator=(GDateTime* in); + DateTime(GTimeZone* tz, GDateTime* dt); + DateTime(GTimeZone* tz, int year, int month, int day, int hour, int minute, double seconds); DateTime& operator=(const DateTime& in); DateTime to_timezone(const std::string& zone) const; - DateTime add_full(int years, int months, int days, int hours, int minutes, double seconds) const; - void reset(GDateTime* in=nullptr); + DateTime start_of_month() const; + DateTime start_of_day() const; + DateTime start_of_minute() const; + DateTime end_of_day() const; + DateTime end_of_month() const; + DateTime add_days(int days) const; + DateTime add_full(int year, int month, int day, int hour, int minute, double seconds) const; GDateTime* get() const; GDateTime* operator()() const {return get();} @@ -66,9 +72,11 @@ public: static bool is_same_day(const DateTime& a, const DateTime& b); static bool is_same_minute(const DateTime& a, const DateTime& b); - bool is_set() const { return m_dt != nullptr; } + bool is_set() const { return m_tz && m_dt; } private: + void reset(GTimeZone*, GDateTime*); + std::shared_ptr<GTimeZone> m_tz; std::shared_ptr<GDateTime> m_dt; }; |