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.
This commit is contained in:
+2
-6
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user