From 0724d4092ecf047e5f3c0136c10c42e7b4b0cd29 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Tue, 5 Dec 2017 21:15:34 -0600 Subject: [PATCH] event: Save local time correctly The old code here was not setting tzid correctly. It me took hours to figure out how to do this, but it turned out to be simple once I found the right place, buried deep in the e-d-s source code. Now, ideally we would not change the timezone of the event every time we edit it. But some big changes in how GNOME Calendar tracks timezone are going to be required if we do that. In particular, I believe we would have to stop saving all day events in UTC, and give up on using GDateTime as we do now, and track timezone completely separately everywhere using icaltimezone. This is what e-d-s does, and it's probably what we should be doing too. But that would be a big change. This commit solves the basic problem, which is to ensure the event is scheduled for the right time, regardless of timezone. This finally completely fixes #168. --- src/gcal-event.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gcal-event.c b/src/gcal-event.c index dc606635..a7aaa00a 100644 --- a/src/gcal-event.c +++ b/src/gcal-event.c @@ -240,12 +240,8 @@ build_component_from_datetime (GcalEvent *self, } else { - gchar *tzid; - - tzid = g_date_time_format (dt, "%Z"); - comp_dt->value->zone = icaltimezone_get_builtin_timezone_from_tzid (tzid); - /* This transfers ownership of tzid. */ - comp_dt->tzid = tzid; + comp_dt->value->zone = e_cal_util_get_system_timezone (); + comp_dt->tzid = g_strdup (icaltimezone_get_tzid ((icaltimezone *) comp_dt->value->zone)); } return comp_dt;