! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
xfce4-weather-plugin shows local times in UTC instead of current timezone
Status:
RESOLVED: FIXED
Product:
Xfce4-weather-plugin
Component:
General

Comments

Description Alexander Zagrebin 2017-02-17 14:21:50 CET
Created attachment 7002 
patch

I've noticed, that the xfce4-weather-plugin always shows local times in UTC instead of my local timezone.

The reason is in function my_timegm() (weather-parsers.c).
This function attempts to keep a current timezone, obtained with a call to g_getenv(), changes a timezone to UTC via g_setenv(), and then restores a current timezone to early saved one.

But at least on FreeBSD there is a problem:
g_getenv returns a pointer to the area, where system stores the environment. So my_timegm() keeps for a later use a pointer to current value of the TZ environment variable. A subsequent call to g_setenv() changes value of the TZ variable in-place, so now the saved pointer refers to a value which was set by g_setenv(), but not to a previous timezone. As result an attempt to restore current timezone does nothing.

The attached patch resolves a problem.
Comment 1 Harald Judt editbugs 2017-02-17 20:20:58 CET
This seems fine, thanks for the patch. I'll test it and also try to find some other FreeBSD user(s) to test it and if there is no negative feedback, apply this before releasing the next version.
Comment 2 Harald Judt editbugs 2017-04-25 12:32:41 CEST
I've pushed this to git master, so it will be included in the next release. Thanks for your patch.

https://git.xfce.org/panel-plugins/xfce4-weather-plugin/commit/?id=701222e668699b192f7109d917851c69f4e6efb8

Bug #13358

Reported by:
Alexander Zagrebin
Reported on: 2017-02-17
Last modified on: 2017-04-25

People

Assignee:
Harald Judt
CC List:
1 user

Version

Attachments

patch (517 bytes, text/x-csrc)
2017-02-17 14:21 CET , Alexander Zagrebin
no flags

Additional information