silk/native_clock
Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, x86_64-unknown-linux-gnu.
Selected libc clocks and source-owned canonical result and wait policy.
When to use
Use NativeClock to implement the native SystemClock and MonotonicClock providers.
Portable applications should require those replaceable services instead.
Details
Selected declarations match the pinned Darwin/GNU clock ABI. Reads validate initialized Timespec records. Waits retain one deadline across interruptions; GNU uses direct status and Darwin captures errno only after a failed relative sleep.
Gotchas
Operations trap on failed or invalid results and block the calling host thread during waits. Native declarations are absent on unsupported and no-libc profiles.
Import as NativeClock with import silk.native_clock { NativeClock }.
Public declarations: 1.
NativeClock
pub struct NativeClockSource-owned validation and blocking wait operations for selected native clocks.
Associated function NativeClock.now
pub effect<'static> fn now(monotonic: bool) -> InstantReads canonical civil time, or a nonnegative mark on the native monotonic timeline.
Gotchas
A failed call or malformed result traps. monotonic selects the clock domain.
Associated function NativeClock.resolution
pub effect<'static> fn resolution(monotonic: bool) -> u64Returns the positive nominal resolution of the selected clock in whole nanoseconds.
Gotchas
Failed calls, noncanonical fields, zero resolution and checked overflow trap.
Associated function NativeClock.waitUntil
pub effect<'static> fn waitUntil(when: Instant) -> ()Blocks the host thread until a nonnegative deadline on this native monotonic timeline.
Details
Retries retain the original deadline. GNU errors come from direct status; Darwin relative sleeps recompute the remaining interval after success or interruption.
Gotchas
A negative deadline, failed call or unrepresentable result traps. This does not park a Fiber.