aboutsummaryrefslogtreecommitdiff
path: root/src/locations.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-01-14 23:07:10 -0600
committerCharles Kerr <charles.kerr@canonical.com>2014-01-14 23:07:10 -0600
commitee64bb2698adfe27e55615a8856b0e2c78ad8469 (patch)
treeb8fb6e1440ac700f7f51e5c765303abb315c6399 /src/locations.cpp
parent3b8833efe6ab21387b6f73b4a4ef757445801623 (diff)
downloadayatana-indicator-datetime-ee64bb2698adfe27e55615a8856b0e2c78ad8469.tar.gz
ayatana-indicator-datetime-ee64bb2698adfe27e55615a8856b0e2c78ad8469.tar.bz2
ayatana-indicator-datetime-ee64bb2698adfe27e55615a8856b0e2c78ad8469.zip
Function: add fully-tested ActionGroups, per-profile Menus, state object.
Form: Add code annotations/comments. Remove dead code. Use Mir style guide. Todo: GSettings toggles, sync with new dbus-test-runner API, get GNOME Panel building again
Diffstat (limited to 'src/locations.cpp')
-rw-r--r--src/locations.cpp33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/locations.cpp b/src/locations.cpp
index 5c3c52b..d6ab73a 100644
--- a/src/locations.cpp
+++ b/src/locations.cpp
@@ -26,16 +26,39 @@ namespace indicator {
namespace datetime {
Location::Location(const std::string& zone_, const std::string& name_):
- zone(zone_),
- name(name_)
+ m_zone(zone_),
+ m_name(name_)
{
- GTimeZone * gzone = g_time_zone_new (zone.c_str());
- GDateTime * gtime = g_date_time_new_now (gzone);
- offset = g_date_time_get_utc_offset (gtime);
+ auto gzone = g_time_zone_new (zone().c_str());
+ auto gtime = g_date_time_new_now (gzone);
+ m_offset = g_date_time_get_utc_offset (gtime);
g_date_time_unref (gtime);
g_time_zone_unref (gzone);
}
+#if 0
+DateTime Location::localtime(const DateTime& reference_point) const
+{
+GDateTime * g_date_time_to_timezone (GDateTime *datetime,
+ GTimeZone *tz);
+ auto gzone = g_time_zone_new(zone().c_str());
+ const auto gtime = reference_point.get();
+ auto glocal = g_date_time_new (gzone,
+ g_date_time_get_year(gtime),
+ g_date_time_get_month(gtime),
+ g_date_time_get_day_of_month(gtime),
+ g_date_time_get_hour(gtime),
+ g_date_time_get_minute(gtime),
+ g_date_time_get_seconds(gtime));
+ DateTime local(glocal);
+ g_date_time_unref(glocal);
+ g_message("reference: %zu", (size_t)reference_point.to_unix(), (size_t)local.to_unix());
+ //g_date_time_unref(gtime);
+ g_time_zone_unref(gzone);
+ return local;
+}
+#endif
+
} // namespace datetime
} // namespace indicator
} // namespace unity