mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-12-26 18:10:13 +00:00
Merge pull request #818 from PatriotRossii/feature/determine_time_zone
Update determine_time_zone according to GNU manual
This commit is contained in:
commit
96e3f3d8d3
@ -292,9 +292,20 @@ impl Environment {
|
||||
|
||||
fn determine_time_zone() -> TZResult<TimeZone> {
|
||||
if let Ok(file) = env::var("TZ") {
|
||||
TimeZone::from_file(format!("/usr/share/zoneinfo/{}", file))
|
||||
}
|
||||
else {
|
||||
TimeZone::from_file({
|
||||
if file.starts_with("/") {
|
||||
file
|
||||
} else {
|
||||
format!("/usr/share/zoneinfo/{}", {
|
||||
if file.starts_with(":") {
|
||||
file.replacen(":", "", 1)
|
||||
} else {
|
||||
file
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
TimeZone::from_file("/etc/localtime")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user