mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-22 12:05:11 +00:00
Update determine_time_zone function to check TZ
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.
This commit is contained in:
parent
78ba0b8973
commit
e8d69fc5e8
@ -1,4 +1,5 @@
|
||||
use std::cmp::max;
|
||||
use std::env;
|
||||
use std::fmt;
|
||||
use std::ops::Deref;
|
||||
use std::sync::{Mutex, MutexGuard};
|
||||
@ -286,7 +287,12 @@ impl Environment {
|
||||
}
|
||||
|
||||
fn determine_time_zone() -> TZResult<TimeZone> {
|
||||
TimeZone::from_file("/etc/localtime")
|
||||
let tz = env::var("TZ");
|
||||
if tz.is_err() {
|
||||
return TimeZone::from_file("/etc/localtime");
|
||||
} else {
|
||||
return TimeZone::from_file(format!("/usr/share/zoneinfo/{}", tz.unwrap()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user