diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2024-04-09 07:46:54 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-08 21:46:54 +0000 |
commit | 6157c8563484e53b1917c811e94e4b5afa01dc67 (patch) | |
tree | fb7378f3b69d60c51fa41a52ca862b2a737316b4 /ext/cron | |
parent | 214bfa37aa41de05f264bee0c2365a7df2098282 (diff) |
refactor: use `chrono::DateTime::from_timestamp` (#23273)
`chrono::NaiveDateTime::from_timestamp_opt()` was deprecated in
https://github.com/chronotope/chrono/pull/1473.
Prerequisite for #23272.
Diffstat (limited to 'ext/cron')
-rw-r--r-- | ext/cron/time.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/ext/cron/time.rs b/ext/cron/time.rs index c39882f7b..3a5565332 100644 --- a/ext/cron/time.rs +++ b/ext/cron/time.rs @@ -10,10 +10,6 @@ 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_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() } |