summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli/src/cmds
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2020-09-24 11:26:43 +0200
committerDavid Lönnhager <david.l@mullvad.net>2020-09-24 11:26:43 +0200
commita22d183761984af94b8d14c3dfaa7d4ee5162091 (patch)
treec122a767a346e7d685d18aa76f76eeae9008ab3e /mullvad-cli/src/cmds
parent503ee993d33611c9fc81ac57d1f2366c380525fa (diff)
downloadmullvadvpn-a22d183761984af94b8d14c3dfaa7d4ee5162091.tar.xz
mullvadvpn-a22d183761984af94b8d14c3dfaa7d4ee5162091.zip
Show timezone for timestamps in the CLI
Diffstat (limited to 'mullvad-cli/src/cmds')
-rw-r--r--mullvad-cli/src/cmds/account.rs4
-rw-r--r--mullvad-cli/src/cmds/tunnel.rs4
2 files changed, 6 insertions, 2 deletions
diff --git a/mullvad-cli/src/cmds/account.rs b/mullvad-cli/src/cmds/account.rs
index ef5c117c41..f68e2a12eb 100644
--- a/mullvad-cli/src/cmds/account.rs
+++ b/mullvad-cli/src/cmds/account.rs
@@ -153,7 +153,9 @@ impl Account {
}
fn format_expiry(expiry: &Timestamp) -> String {
- chrono::NaiveDateTime::from_timestamp(expiry.seconds, expiry.nanos as u32).to_string()
+ let ndt = chrono::NaiveDateTime::from_timestamp(expiry.seconds, expiry.nanos as u32);
+ let utc = chrono::DateTime::<chrono::Utc>::from_utc(ndt, chrono::Utc);
+ utc.with_timezone(&chrono::Local).to_string()
}
async fn clear_history(&self) -> Result<()> {
diff --git a/mullvad-cli/src/cmds/tunnel.rs b/mullvad-cli/src/cmds/tunnel.rs
index 528ebd005e..0a2680ebfd 100644
--- a/mullvad-cli/src/cmds/tunnel.rs
+++ b/mullvad-cli/src/cmds/tunnel.rs
@@ -317,6 +317,8 @@ impl Tunnel {
}
fn format_key_timestamp(timestamp: &Timestamp) -> String {
- chrono::NaiveDateTime::from_timestamp(timestamp.seconds, timestamp.nanos as u32).to_string()
+ let ndt = chrono::NaiveDateTime::from_timestamp(timestamp.seconds, timestamp.nanos as u32);
+ let utc = chrono::DateTime::<chrono::Utc>::from_utc(ndt, chrono::Utc);
+ utc.with_timezone(&chrono::Local).to_string()
}
}