From 67de67a1062eae7bbd9bc1ac228f75263f5ac104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 26 Jul 2023 03:40:09 +0200 Subject: chore: update chrono dependency (#19943) Pulled from https://github.com/denoland/deno/pull/19747 Authored-by: Cooper Benson --- cli/Cargo.toml | 2 +- cli/util/time.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'cli') 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 { 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) } -- cgit v1.2.3