diff --git a/cli/util/time.rs b/cli/util/time.rs index 2ecc35da6f7156..47306c1265424b 100644 --- a/cli/util/time.rs +++ b/cli/util/time.rs @@ -14,10 +14,6 @@ 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_opt( - now.as_secs() as i64, - now.subsec_nanos(), - ) - .unwrap(); - chrono::DateTime::from_naive_utc_and_offset(naive, chrono::Utc) + chrono::DateTime::from_timestamp(now.as_secs() as i64, now.subsec_nanos()) + .unwrap() } diff --git a/ext/cron/time.rs b/ext/cron/time.rs index c39882f7b39988..3a5565332a06e8 100644 --- a/ext/cron/time.rs +++ b/ext/cron/time.rs @@ -10,10 +10,6 @@ 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_opt( - now.as_secs() as i64, - now.subsec_nanos(), - ) - .unwrap(); - chrono::DateTime::from_naive_utc_and_offset(naive, chrono::Utc) + chrono::DateTime::from_timestamp(now.as_secs() as i64, now.subsec_nanos()) + .unwrap() } diff --git a/ext/kv/time.rs b/ext/kv/time.rs index c39882f7b39988..3a5565332a06e8 100644 --- a/ext/kv/time.rs +++ b/ext/kv/time.rs @@ -10,10 +10,6 @@ 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_opt( - now.as_secs() as i64, - now.subsec_nanos(), - ) - .unwrap(); - chrono::DateTime::from_naive_utc_and_offset(naive, chrono::Utc) + chrono::DateTime::from_timestamp(now.as_secs() as i64, now.subsec_nanos()) + .unwrap() }