Skip to content

Commit

Permalink
Tasks: Ensure ICalTime::zone is set for current time
Browse files Browse the repository at this point in the history
Without having set correct time zone for the ICalTime the conversion
routines can convert time twice into the destination time zone,
which causes wrong time. It could be seen also when comparing
the current time with the component time.

Related to libical/libical#571
  • Loading branch information
mcrha committed May 11, 2022
1 parent 6397879 commit df3b391
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/calendar/gui/e-cal-model-tasks.c
Expand Up @@ -363,6 +363,7 @@ get_due_status (ECalModelTasks *model,
}

now_tt = i_cal_time_new_current_with_zone (zone);
i_cal_time_set_timezone (now_tt, zone);

if (i_cal_time_compare (due_tt, now_tt) <= 0)
res = E_CAL_MODEL_TASKS_DUE_OVERDUE;
Expand Down
3 changes: 3 additions & 0 deletions src/calendar/gui/e-to-do-pane.c
Expand Up @@ -906,6 +906,7 @@ etdp_get_comp_colors (EToDoPane *to_do_pane,
etdp_itt_to_zone (itt, e_cal_component_datetime_get_tzid (dt), client, default_zone);

now = i_cal_time_new_current_with_zone (default_zone);
i_cal_time_set_timezone (now, default_zone);

if ((is_date && i_cal_time_compare_date_only (itt, now) <= 0) ||
(!is_date && i_cal_time_compare (itt, now) <= 0)) {
Expand Down Expand Up @@ -1485,6 +1486,7 @@ etdp_check_time_changed (EToDoPane *to_do_pane,

zone = e_cal_data_model_get_timezone (to_do_pane->priv->events_data_model);
itt = i_cal_time_new_current_with_zone (zone);
i_cal_time_set_timezone (itt, zone);
new_today = etdp_create_date_mark (itt);

if (force_update || new_today != to_do_pane->priv->last_today) {
Expand Down Expand Up @@ -1924,6 +1926,7 @@ etdp_new_common (EToDoPane *to_do_pane,
time_divisions_secs = g_settings_get_int (settings, "time-divisions") * 60;
zone = e_cal_data_model_get_timezone (to_do_pane->priv->events_data_model);
now = i_cal_time_new_current_with_zone (zone);
i_cal_time_set_timezone (now, zone);

i_cal_time_set_year (now, date_mark / 10000);
i_cal_time_set_month (now, (date_mark / 100) % 100);
Expand Down

0 comments on commit df3b391

Please sign in to comment.