summaryrefslogtreecommitdiffstats
path: root/src/output/details.rs
diff options
context:
space:
mode:
authorBen S <ogham@bsago.me>2016-02-11 15:52:40 +0000
committerBen S <ogham@bsago.me>2016-02-11 15:52:40 +0000
commit252eba484476369bb966fb1af7f739732b968fc0 (patch)
treeac7309de8959af9209220cfdf373d6f2d6f7c097 /src/output/details.rs
parent767d9fc283d40097306ef497f11071feacd9dfed (diff)
Improve error when we can't find a time zone
Diffstat (limited to 'src/output/details.rs')
-rw-r--r--src/output/details.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/output/details.rs b/src/output/details.rs
index 8736036..6074b4f 100644
--- a/src/output/details.rs
+++ b/src/output/details.rs
@@ -165,11 +165,21 @@ pub struct Environment<U: Users+Groups> {
impl Default for Environment<UsersCache> {
fn default() -> Self {
+ use std::process::exit;
+
+ let tz = match determine_time_zone() {
+ Ok(tz) => tz,
+ Err(e) => {
+ println!("Unable to determine time zone: {}", e);
+ exit(1);
+ },
+ };
+
Environment {
current_year: LocalDateTime::now().year(),
numeric: locale::Numeric::load_user_locale().unwrap_or_else(|_| locale::Numeric::english()),
time: locale::Time::load_user_locale().unwrap_or_else(|_| locale::Time::english()),
- tz: determine_time_zone().expect("Unable to determine time zone"),
+ tz: tz,
users: Mutex::new(UsersCache::new()),
}
}