Skip to content

Commit

Permalink
Merge pull request #725 from kbravh/tz-variable-patch
Browse files Browse the repository at this point in the history
Update determine_time_zone function to check TZ
  • Loading branch information
ogham authored Oct 8, 2020
2 parents ba5547b + 5be0286 commit 8b852cb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/output/table.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::cmp::max;
use std::env;
use std::fmt;
use std::ops::Deref;
use std::sync::{Mutex, MutexGuard};
Expand Down Expand Up @@ -291,7 +292,11 @@ impl Environment {
}

fn determine_time_zone() -> TZResult<TimeZone> {
TimeZone::from_file("/etc/localtime")
if let Ok(file) = env::var("TZ") {
TimeZone::from_file(format!("/usr/share/zoneinfo/{}", file))
} else {
TimeZone::from_file("/etc/localtime")
}
}


Expand Down

0 comments on commit 8b852cb

Please sign in to comment.