diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/Cargo.toml | 2 | ||||
-rw-r--r-- | cli/util/time.rs | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 604f9dfbe..2306d4333 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -60,7 +60,7 @@ base32 = "=0.4.0" base64.workspace = true bincode = "=1.3.3" cache_control.workspace = true -chrono = { version = "=0.4.22", default-features = false, features = ["std"] } +chrono = { version = "=0.4.26", default-features = false, features = ["std"] } clap = { version = "=4.3.3", features = ["string"] } clap_complete = "=4.3.1" clap_complete_fig = "=4.3.1" diff --git a/cli/util/time.rs b/cli/util/time.rs index 9c5b48b57..5c1a89d48 100644 --- a/cli/util/time.rs +++ b/cli/util/time.rs @@ -14,9 +14,10 @@ pub fn utc_now() -> chrono::DateTime<chrono::Utc> { let now = std::time::SystemTime::now() .duration_since(std::time::UNIX_EPOCH) .expect("system time before Unix epoch"); - let naive = chrono::NaiveDateTime::from_timestamp( + let naive = chrono::NaiveDateTime::from_timestamp_opt( now.as_secs() as i64, now.subsec_nanos(), - ); + ) + .unwrap(); chrono::DateTime::from_utc(naive, chrono::Utc) } |