Skip to main content

Module time

Module time 

Source
Expand description

proxima_core::time (re-exported as proxima::time) — runtime-agnostic timer primitives shaped like tokio::time. The active backend (host thread, embassy, prime’s per-core wheel, deterministic mock, or a user-supplied hardware driver) is selected by the active proxima_build::Profile via the timer axis; build.rs bakes a &'static dyn Driver symbol into the build, so Sleep::poll’s only runtime cost is one virtual dispatch.

Folded in from the former proxima-time satellite crate (single consumer: the workspace’s timer surface) — proxima_core::time::{sleep, timeout, interval, Driver, Instant} is unchanged for callers that used to spell it proxima_time::{..}.

Modules§

drivers
First-party Driver implementations. Each is behind its own time-driver-* feature; the active driver is bound at link time via BOUND_DRIVER (emitted by proxima-core/build.rs).

Structs§

Elapsed
Returned by timeout when the supplied duration passes before the wrapped future completes. Matches tokio::time::error::Elapsed.
Instant
Monotonic point in time. Internally a Duration since the active driver’s epoch — comparisons and arithmetic are well-defined as long as both operands came from the same driver instance, which the link-time-bound BOUND_DRIVER guarantees.
Interval
Periodic timer. .tick().await returns the Instant at which the tick fired (matching tokio); also implements Stream<Item = ()>.
Sleep
Future returned by sleep / sleep_until. Resolves when the active driver’s now() reaches deadline.
Tick
Future returned by Interval::tick.

Enums§

MissedTickBehavior
What happens when an Interval consumer skips past a tick deadline (consumer time exceeded the period). Shape matches tokio::time::MissedTickBehavior.

Statics§

BOUND_DRIVER

Traits§

Driver
The timer driver interface every backend implements. Selected at build time by the timer axis of the active profile; bound at link time via the static BOUND_DRIVER symbol proxima-time’s build emits.

Functions§

interval
Stream + tick-future hybrid that yields every period, with the first item delivered immediately. Matches tokio::time::interval ergonomically (.tick().await -> Instant) AND exposes Stream<Item = ()> for callers that prefer that shape.
interval_at
Like interval but the first tick fires at start rather than immediately.
now
Capture the current monotonic time from the link-time-bound driver. (The driver-free Instant in the leaf cannot reach BOUND_DRIVER, so now() lives here.)
sleep
Resolves after duration has elapsed on the bound driver’s clock. Shape-compatible with tokio::time::sleep.
sleep_until
Resolves at the given deadline. Shape-compatible with tokio::time::sleep_until. If the deadline is in the past, the returned future resolves on first poll.
timeout
Race future against a timer of duration. Returns Err(Elapsed) if the timer fires first.
timeout_at
Race future against a deadline. Shape-compatible with tokio::time::timeout_at.