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:
@@ -749,8 +749,8 @@ impl<'a> wasi_unstable::WasiUnstable for WasiCtx {
|
|||||||
types::SubscriptionU::Clock(clocksub) => match clocksub.id {
|
types::SubscriptionU::Clock(clocksub) => match clocksub.id {
|
||||||
types::Clockid::Monotonic => {
|
types::Clockid::Monotonic => {
|
||||||
let clock = self.clocks.monotonic.deref();
|
let clock = self.clocks.monotonic.deref();
|
||||||
let precision = Duration::from_micros(clocksub.precision);
|
let precision = Duration::from_nanos(clocksub.precision);
|
||||||
let duration = Duration::from_micros(clocksub.timeout);
|
let duration = Duration::from_nanos(clocksub.timeout);
|
||||||
let deadline = if clocksub
|
let deadline = if clocksub
|
||||||
.flags
|
.flags
|
||||||
.contains(types::Subclockflags::SUBSCRIPTION_CLOCK_ABSTIME)
|
.contains(types::Subclockflags::SUBSCRIPTION_CLOCK_ABSTIME)
|
||||||
|
|||||||
@@ -920,8 +920,8 @@ impl<'a> wasi_snapshot_preview1::WasiSnapshotPreview1 for WasiCtx {
|
|||||||
types::SubscriptionU::Clock(clocksub) => match clocksub.id {
|
types::SubscriptionU::Clock(clocksub) => match clocksub.id {
|
||||||
types::Clockid::Monotonic => {
|
types::Clockid::Monotonic => {
|
||||||
let clock = self.clocks.monotonic.deref();
|
let clock = self.clocks.monotonic.deref();
|
||||||
let precision = Duration::from_micros(clocksub.precision);
|
let precision = Duration::from_nanos(clocksub.precision);
|
||||||
let duration = Duration::from_micros(clocksub.timeout);
|
let duration = Duration::from_nanos(clocksub.timeout);
|
||||||
let deadline = if clocksub
|
let deadline = if clocksub
|
||||||
.flags
|
.flags
|
||||||
.contains(types::Subclockflags::SUBSCRIPTION_CLOCK_ABSTIME)
|
.contains(types::Subclockflags::SUBSCRIPTION_CLOCK_ABSTIME)
|
||||||
|
|||||||
Reference in New Issue
Block a user