changelog should be complete
All checks were successful
Rust/spacepackets/pipeline/pr-main This commit looks good
Rust/spacepackets/pipeline/head This commit looks good

This commit is contained in:
2023-01-15 21:47:35 +01:00
parent 708b68a5cb
commit c8d442690b
2 changed files with 27 additions and 6 deletions

View File

@ -292,6 +292,13 @@ impl UnixTimestamp {
}
secs
}
pub fn as_date_time(&self) -> LocalResult<DateTime<Utc>> {
Utc.timestamp_opt(
self.unix_seconds,
self.subsecond_millis.unwrap_or(0) as u32 * 10_u32.pow(6),
)
}
}
impl From<DateTime<Utc>> for UnixTimestamp {