wasi-common: Timestamps should be in nanoseconds (#2717)

Sleeping takes 1000x longer than it should because the timestamps are
interpreted as microseconds by accident.
This commit is contained in:
Christopher Serr
2021-03-10 16:09:34 +01:00
committed by GitHub
parent f8cc824396
commit cc84c693a3
2 changed files with 4 additions and 4 deletions

View File

@@ -749,8 +749,8 @@ impl<'a> wasi_unstable::WasiUnstable for WasiCtx {
types::SubscriptionU::Clock(clocksub) => match clocksub.id {
types::Clockid::Monotonic => {
let clock = self.clocks.monotonic.deref();
let precision = Duration::from_micros(clocksub.precision);
let duration = Duration::from_micros(clocksub.timeout);
let precision = Duration::from_nanos(clocksub.precision);
let duration = Duration::from_nanos(clocksub.timeout);
let deadline = if clocksub
.flags
.contains(types::Subclockflags::SUBSCRIPTION_CLOCK_ABSTIME)

View File

@@ -920,8 +920,8 @@ impl<'a> wasi_snapshot_preview1::WasiSnapshotPreview1 for WasiCtx {
types::SubscriptionU::Clock(clocksub) => match clocksub.id {
types::Clockid::Monotonic => {
let clock = self.clocks.monotonic.deref();
let precision = Duration::from_micros(clocksub.precision);
let duration = Duration::from_micros(clocksub.timeout);
let precision = Duration::from_nanos(clocksub.precision);
let duration = Duration::from_nanos(clocksub.timeout);
let deadline = if clocksub
.flags
.contains(types::Subclockflags::SUBSCRIPTION_CLOCK_ABSTIME)