finish implementing clocks correctly

This commit is contained in:
Pat Hickey
2021-01-04 16:28:40 -08:00
parent add601fd6c
commit 41c06db2b4
2 changed files with 11 additions and 3 deletions

View File

@@ -173,7 +173,8 @@ impl<'a> wasi_snapshot_preview1::WasiSnapshotPreview1 for WasiCtx {
}
types::Clockid::Monotonic => {
let now = self.clocks.monotonic.now(precision);
todo!()
let d = now.duration_since(self.clocks.creation_time);
Ok(d.as_nanos().try_into()?)
}
types::Clockid::ProcessCputimeId | types::Clockid::ThreadCputimeId => Err(Error::Badf),
}