Skip to content

Commit cb37249

Browse files
authored
Merge pull request #17 from Neotron-Compute/chrono_fixes
Update some chrono APIs.
2 parents a1d8bcd + efc5e65 commit cb37249

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/types.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,13 @@ impl core::fmt::Display for Time {
407407
impl From<&Time> for chrono::DateTime<chrono::Utc> {
408408
fn from(time: &Time) -> Self {
409409
use chrono::prelude::*;
410-
let our_epoch = Utc.ymd(2001, 1, 1).and_hms(0, 0, 0).timestamp();
411-
chrono::Utc.timestamp(i64::from(time.secs) + our_epoch, time.nsecs)
410+
let our_epoch = Utc
411+
.with_ymd_and_hms(2000, 1, 1, 0, 0, 0)
412+
.unwrap()
413+
.timestamp();
414+
chrono::Utc
415+
.timestamp_opt(i64::from(time.secs) + our_epoch, time.nsecs)
416+
.unwrap()
412417
}
413418
}
414419

0 commit comments

Comments
 (0)