Skip to content
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

Merged
merged 2 commits into from
Oct 8, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 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 @@ -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()));
}
}


Expand Down