[gnome-calendar/mcatanzaro/timezone] event: Save local time correctly



commit 70e8fd91340d3bbbd56870317f3aa97cd291668f
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Tue Dec 5 21:15:34 2017 -0600

    event: Save local time correctly
    
    The original code here was not setting tzid correctly. It 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 dc60663..a7aaa00 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]