Skip to main content

TimeSource

Trait TimeSource 

Source
pub trait TimeSource {
    // Required method
    fn now_ms(&self) -> u64;
}
Expand description

High-resolution time source for the executor’s time-budget accounting.

When registered via init_time_source, the executor queries this before and after each task poll to decide whether it should yield control back to the host event loop (default budget: 8 ms).

In Wasm environments the implementation typically delegates to performance.now(). If no TimeSource is registered the time budget check is a no-op and the executor runs tasks until the queues are drained.

Required Methods§

Source

fn now_ms(&self) -> u64

Return the current time in milliseconds.

Implementors§