From 7e9b4645721cc76322198df3b55f4cdedc55c200 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 6 Apr 2015 13:17:39 -0500 Subject: in new EDS code, use timezones consistently --- src/engine-eds.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/engine-eds.cpp b/src/engine-eds.cpp index 2b62fd1..073b39d 100644 --- a/src/engine-eds.cpp +++ b/src/engine-eds.cpp @@ -497,11 +497,16 @@ private: auto status = ICAL_STATUS_NONE; e_cal_component_get_status(component, &status); - const auto begin_dt = DateTime(begin); - const auto end_dt = DateTime(end); + // get the timezone we want to use for generated Appointments/Alarms + const char * location = icaltimezone_get_location(subtask->default_timezone); + auto gtz = g_time_zone_new(location); + g_debug("timezone abbreviation is %s", g_time_zone_get_abbreviation (gtz, 0)); + + const DateTime begin_dt { gtz, begin }; + const DateTime end_dt { gtz, end }; g_debug ("got appointment from %s to %s, uid %s status %d", - begin_dt.format("%F %T").c_str(), - end_dt.format("%F %T").c_str(), + begin_dt.format("%F %T %z").c_str(), + end_dt.format("%F %T %z").c_str(), uid, (int)status); @@ -560,7 +565,7 @@ private: if (a != nullptr) { - const DateTime alarm_begin{ai->trigger}; + const DateTime alarm_begin{gtz, ai->trigger}; auto& alarm = alarms[alarm_begin]; if (alarm.text.empty()) @@ -608,6 +613,8 @@ private: subtask->task->appointments.push_back(appointment); } + + g_time_zone_unref(gtz); } return G_SOURCE_CONTINUE; -- cgit v1.2.3