-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use TZDIR for ZONEINFO_DIR if the variable is set. #120
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TZDIR
: If this variable is set its value takes precedence over the system configured timezone database directory path.
How is that testable? |
For test, I think you can set TZDIR point to a tzdata-2022a version, which will lack |
How did you test that it works? |
The question was more how/where to set old obsolete TZ data, and not to set up a location in our gui. |
Deleting/re-adding /usr/share/africa and selecting Johannesburg works fine, so i assume this change is working. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -71,7 +71,10 @@ parse_tzdata (const char *tzname, time_t start, time_t end, | |||
char initial_isdst, second_isdst; | |||
int i; | |||
|
|||
filename = g_build_filename (ZONEINFO_DIR, tzname, NULL); | |||
tzdir = g_getenv ("TZDIR"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry , i didn't saw that during review.
We got a build warning here.
https://app.travis-ci.com/github/mate-desktop/libmateweather/jobs/606993727#L1649
mateweather-timezone.c:74:11: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
74 | tzdir = g_getenv ("TZDIR");
| ^
@iyzsong
Any chance to fix the warning?
raveit65 ***@***.***> writes:
@raveit65 commented on this pull request.
--------------------------------------------------------------------------------------------------------------------
In libmateweather/mateweather-timezone.c:
> @@ -71,7 +71,10 @@ parse_tzdata (const char *tzname, time_t start, time_t end,
char initial_isdst, second_isdst;
int i;
- filename = g_build_filename (ZONEINFO_DIR, tzname, NULL);
+ tzdir = g_getenv ("TZDIR");
Sorry , i didn't saw that during review.
We got a build warning here.
https://app.travis-ci.com/github/mate-desktop/libmateweather/jobs/606993727#L1649
Sorry , i didn't saw that during review.
We got a build warning here
@iyzsong
Any chance to fix the warning?
Hello, declare tzdir as 'const char *tzdir' instead of 'char *tzdir'
should fix the the warning.
|
@iyzsong |
Hello, this is needed on Guix where there is no /usr and TZDIR is changed when the tzdata package got updated.
Also glibc use it, so it seems reasonable thing to me. eg: https://www.man7.org/linux/man-pages/man3/tzset.3.html
Thanks.