summaryrefslogtreecommitdiff
path: root/ext/cron
diff options
context:
space:
mode:
authorAsher Gomez <ashersaupingomez@gmail.com>2024-04-09 07:46:54 +1000
committerGitHub <noreply@github.com>2024-04-08 21:46:54 +0000
commit6157c8563484e53b1917c811e94e4b5afa01dc67 (patch)
treefb7378f3b69d60c51fa41a52ca862b2a737316b4 /ext/cron
parent214bfa37aa41de05f264bee0c2365a7df2098282 (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.rs8
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()
}