[evolution/gnome-42] Tasks: Ensure ICalTime::zone is set for current time



commit a987e41cecc215a8d82483ff6c266b2dbc748e7d
Author: Milan Crha <mcrha redhat com>
Date:   Wed May 11 14:27:17 2022 +0200

    Tasks: Ensure ICalTime::zone is set for current time
    
    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 https://github.com/libical/libical/issues/571

 src/calendar/gui/e-cal-model-tasks.c | 1 +
 src/calendar/gui/e-to-do-pane.c      | 3 +++
 2 files changed, 4 insertions(+)
---
diff --git a/src/calendar/gui/e-cal-model-tasks.c b/src/calendar/gui/e-cal-model-tasks.c
index 44134cbebd..897481d806 100644
--- a/src/calendar/gui/e-cal-model-tasks.c
+++ b/src/calendar/gui/e-cal-model-tasks.c
@@ -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;
diff --git a/src/calendar/gui/e-to-do-pane.c b/src/calendar/gui/e-to-do-pane.c
index 852668e417..525732c98d 100644
--- a/src/calendar/gui/e-to-do-pane.c
+++ b/src/calendar/gui/e-to-do-pane.c
@@ -905,6 +905,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)) {
@@ -1484,6 +1485,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) {
@@ -1923,6 +1925,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);


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