On Sun, Apr 17, 2016 at 08:32:35AM -0400, Michal Hocko wrote: > On Sun, Apr 17, 2016 at 02:29:15PM +0200, Yves-Alexis Perez wrote: > > On dim., 2016-04-17 at 06:52 -0400, Michal Hocko wrote: > > > Hi, > > > I have changed my system wide timezone setting by > > > dpkg-reconfigure tzdata > > > > > > and `date' really displays the time according to the new timezone. Clock > > > in the pannel still shows the original TZ data though. Is this behavior > > > intentional? > > > The time is correct when I update the timezone settings directly in the > > > Clock properties but I would expect that the clock would use the system > > > settings. > > > > It does, but it might need some time to actually refresh (maybe at the next > > refresh, or maybe at the next restart). > > I have changed my setup yesterday so I guess it will be the later which > is more than unfortunate because I do not restart X session very often > (it's typically with the new kernel rc). Is this fixable? I have to > admit I didn't have time to look into the sources yet but I thought that > the applet would simply use the localtime and that should get updated > automatically.
I have tried to look into this and here is what should work - but I didn't get to test it. See the attached patch. Maybe there are more optimal ways to do this properly but this one looks quite easy. -- Michal Hocko
From: Michal Hocko <msts...@gmail.com> Make sure that clock_time_get_time will always return time with the system wide time zone setting. The administrator can change the timezone at any moment in time and realying on g_time_zone_new_local without checking the global settings changes will lead to outdated results. Rechecking the value everytime the time is requested seems safer. Signed-off-by: Michal Hocko <msts...@gmail.com> Index: xfce4-panel-4.12.0/plugins/clock/clock-time.c =================================================================== --- xfce4-panel-4.12.0.orig/plugins/clock/clock-time.c +++ xfce4-panel-4.12.0/plugins/clock/clock-time.c @@ -200,8 +200,11 @@ clock_time_get_time (ClockTime *time) if (time->timezone != NULL) date_time = g_date_time_new_now (time->timezone); - else - date_time = g_date_time_new_now_local (); + else { + GTimeZone *tz = g_time_zone_new_local(); + date_time = g_date_time_new_now (tz); + g_time_zone_unref(tz) + } return date_time; }