Skip to main content

Clock

Trait Clock 

Source
pub trait Clock: Send + Sync {
    // Required method
    fn now_ms(&self) -> u64;

    // Provided method
    fn sleep(
        &self,
        milliseconds: u64,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>> { ... }
}
Expand description

Supplies monotonic-enough Unix millisecond timestamps to Code Mode.

Required Methods§

Source

fn now_ms(&self) -> u64

Returns the current Unix timestamp in milliseconds.

Provided Methods§

Source

fn sleep( &self, milliseconds: u64, ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>

Waits cooperatively for a deadline check. Worker hosts must override this timer.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§