Skip to main content

Clock

Trait Clock 

Source
pub trait Clock: Sized {
    const TICKS_PER_SEC: u64;

    // Required method
    fn now() -> Instant<Self>;
}
Expand description

A trait for retrieving the current system or hardware time.

Required Associated Constants§

Source

const TICKS_PER_SEC: u64

The number of clock ticks per second.

Required Methods§

Source

fn now() -> Instant<Self>

Returns the current time Instant according to this clock.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl Clock for SystemClock

§

const TICKS_PER_SEC: u64 = 1_000_000_000