[gnome-panel] clock: fix timezone offset in calendar popup
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] clock: fix timezone offset in calendar popup
- Date: Thu, 3 Mar 2022 09:02:03 +0000 (UTC)
commit fb24302e460461509434ad614b232fe171ea48dd
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Thu Mar 3 10:50:18 2022 +0200
clock: fix timezone offset in calendar popup
One more regression from cd1a0db671b6... Before that commit
clock_location_get_offset returned timezone offset in seconds
relative to system timezone.
modules/clock/clock-location.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/modules/clock/clock-location.c b/modules/clock/clock-location.c
index 99ffd7af7..6a448e195 100644
--- a/modules/clock/clock-location.c
+++ b/modules/clock/clock-location.c
@@ -362,7 +362,26 @@ clock_location_is_current (ClockLocation *loc)
glong
clock_location_get_offset (ClockLocation *loc)
{
- return gweather_timezone_get_offset (loc->priv->wtz);
+ GDateTime *datetime;
+ gint64 now;
+ GTimeZone *timezone;
+ int interval;
+ gint32 system_offset;
+ gint32 location_offset;
+
+ datetime = g_date_time_new_now_local ();
+ now = g_date_time_to_unix (datetime);
+ g_date_time_unref (datetime);
+
+ timezone = gnome_wall_clock_get_timezone (loc->priv->wall_clock);
+ interval = g_time_zone_find_interval (timezone, G_TIME_TYPE_STANDARD, now);
+ system_offset = g_time_zone_get_offset (timezone, interval);
+
+ timezone = loc->priv->tz;
+ interval = g_time_zone_find_interval (timezone, G_TIME_TYPE_STANDARD, now);
+ location_offset = g_time_zone_get_offset (timezone, interval);
+
+ return system_offset - location_offset;
}
typedef struct {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]