-
-
Notifications
You must be signed in to change notification settings - Fork 661
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
Update determine_time_zone function to check TZ #725
Conversation
Instead of defaulting immediately to /etc/filename for the timezone, we can first check whether the TZ environment variable is set. If so, we can pull the corresponding timezone file from /usr/share/zoneinfo. Closes #453.
@poliorcetics Thanks for the feedback! I tried out the suggestion you made; I definitely like deconstructing the timezone from the environment variable instead of unwrapping, so I've added that change. The only issue is that we have to use the if let Ok(file) = env::var("TZ") {
return TimeZone::from_file(format!("/usr/share/zoneinfo/{}", file));
}
TimeZone::from_file("/etc/localtime") |
That's because I put if let Ok(file) = env::var("TZ") {
TimeZone::from_file(format!("/usr/share/zoneinfo/{}", file)) // no ;
} else {
TimeZone::from_file("/etc/localtime") // no ;
} |
@poliorcetics That did the trick! Thanks for the help. |
Thanks for this! |
Just bitten by this .. Out of curisosity: Why not use libc::mktime instead of thinking you can outsmart libc? Then all of these timezone issues would just disappear! |
@themadsens Well I can’t speak for ogham, but I would gladly use a It’s certainly an option to drop |
Instead of defaulting immediately to /etc/filename for the timezone, we can first check whether the TZ environment variable is set. If so, we can pull the corresponding timezone file from /usr/share/zoneinfo. Closes #453.