Skip to main content

PlatformClock

Trait PlatformClock 

Source
pub trait PlatformClock {
    // Required methods
    fn now_ticks(&self) -> Ticks;
    fn ticks_to_nanos(&self, ticks: Ticks) -> u64;
    fn nanos_to_ticks(&self, ns: u64) -> Ticks;
}
Expand description

A monotonic platform clock.

The epoch is implementation-defined; monotonicity is required. Conversions allow runtimes to expose a fast tick domain and still provide nanosecond correlation for telemetry and tracing.

Required Methods§

Source

fn now_ticks(&self) -> Ticks

Return the current monotonic tick count.

Source

fn ticks_to_nanos(&self, ticks: Ticks) -> u64

Convert ticks to nanoseconds.

Source

fn nanos_to_ticks(&self, ns: u64) -> Ticks

Convert nanoseconds to ticks.

Implementations on Foreign Types§

Source§

impl PlatformClock for ()

Source§

fn now_ticks(&self) -> Ticks

Source§

fn ticks_to_nanos(&self, ticks: Ticks) -> u64

Source§

fn nanos_to_ticks(&self, ns: u64) -> Ticks

Implementors§