Silk

silk/os_monotonic_clock

Native monotonic clock provider with source-derived relative waiting.

When to use

Construct OsMonotonicClock at a native application edge for elapsed-time measurement and blocking deadlines. Use a scripted provider when tests need virtual advancement.

Details

Construction performs no host call. Reads, resolution queries, and absolute waits use three matching native intrinsics. waitFor performs exactly one starting read and uses checked split-field deadline arithmetic. It then uses the same absolute-wait operation as waitUntil.

Gotchas

Marks and deadlines are meaningful only on this provider's monotonic timeline. Native waits block the calling host thread; they do not park one Fiber. Failure, malformed host output, or deadline overflow is a fatal trap. Linux requires glibc 2.17 or later and excludes system suspend time from this clock. macOS includes system suspend time. Direct WebAssembly has no ambient implementation.

Import as OsMonotonicClock with import silk.os_monotonic_clock.

Public declarations: 2.

OsMonotonicClock

pub struct OsMonotonicClock

A stateless Unix-family native provider of monotonic marks and blocking deadlines.

Gotchas

A failed, invalid, or unrepresentable clock result traps. Direct WebAssembly does not support a reachable operation on this provider.

make

pub fn make() -> OsMonotonicClock

Creates a native monotonic-clock provider without reading the clock or installing a default.

Implementation MonotonicClock.MonotonicClock for OsMonotonicClock

impl MonotonicClock.MonotonicClock for OsMonotonicClock

Operation now

now = OsMonotonicClock.now

Operation getResolution

getResolution = OsMonotonicClock.getResolution

Operation waitUntil

waitUntil = OsMonotonicClock.waitUntil

Operation waitFor

waitFor = OsMonotonicClock.waitFor

On this page