[gnome-calendar/gnome-3-26] event: Save local time correctly



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

    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 f0433f6d..df3d31e2 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]