Skip to content

Commit

Permalink
Fixed a deprecation warning from chrono
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-F-Bryan committed Oct 2, 2023
1 parent ca17dd0 commit 24d971d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/wasix/src/syscalls/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ pub fn platform_clock_time_get(
clock_id: Snapshot0Clockid,
precision: Timestamp,
) -> Result<i64, Errno> {
let new_time: DateTime<Local> = Local::now();
Ok(new_time.timestamp_nanos() as i64)
Local::now()
.timestamp_nanos_opt()
.map(|ts| ts as i64)
.ok_or(Errno::Overflow)
}

0 comments on commit 24d971d

Please sign in to comment.