diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-03-09 21:08:47 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2014-03-09 21:08:47 -0500 |
commit | 3f4d409f21bbb1f79f149a5ee66dcddaa505ddb1 (patch) | |
tree | ab1f4ba4e7635b3ea2cb600cc8de9b3e52a6c9d1 /src/date-time.cpp | |
parent | 375277fa6b2c8eaac2e2a824bd1e43bbd54b75e3 (diff) | |
download | ayatana-indicator-datetime-3f4d409f21bbb1f79f149a5ee66dcddaa505ddb1.tar.gz ayatana-indicator-datetime-3f4d409f21bbb1f79f149a5ee66dcddaa505ddb1.tar.bz2 ayatana-indicator-datetime-3f4d409f21bbb1f79f149a5ee66dcddaa505ddb1.zip |
decouple the planner's states; need three separate sets: upcoming-now (for alarms in the current time), upcoming-calendar (to show events coming from the selected calendar date), and calendar-month (all the appointments in the month displayed in the menu).
Diffstat (limited to 'src/date-time.cpp')
-rw-r--r-- | src/date-time.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/date-time.cpp b/src/date-time.cpp index 432d877..a1c1d1b 100644 --- a/src/date-time.cpp +++ b/src/date-time.cpp @@ -46,14 +46,22 @@ DateTime& DateTime::operator=(const DateTime& that) DateTime::DateTime(time_t t) { - GDateTime * gdt = g_date_time_new_from_unix_local(t); + auto gdt = g_date_time_new_from_unix_local(t); reset(gdt); g_date_time_unref(gdt); } DateTime DateTime::NowLocal() { - GDateTime * gdt = g_date_time_new_now_local(); + auto gdt = g_date_time_new_now_local(); + DateTime dt(gdt); + g_date_time_unref(gdt); + return dt; +} + +DateTime DateTime::Local(int year, int month, int day, int hour, int minute, int seconds) +{ + auto gdt = g_date_time_new_local (year, month, day, hour, minute, seconds); DateTime dt(gdt); g_date_time_unref(gdt); return dt; @@ -97,11 +105,26 @@ std::string DateTime::format(const std::string& fmt) const return ret; } +void DateTime::ymd(int& year, int& month, int& day) const +{ + g_date_time_get_ymd(get(), &year, &month, &day); +} + int DateTime::day_of_month() const { return g_date_time_get_day_of_month(get()); } +int DateTime::hour() const +{ + return g_date_time_get_hour(get()); +} + +int DateTime::minute() const +{ + return g_date_time_get_minute(get()); +} + double DateTime::seconds() const { return g_date_time_get_seconds(get()); |