Skip to main content

PhysicalClock

Trait PhysicalClock 

Source
pub trait PhysicalClock {
    // Required method
    fn now_micros(&self) -> i64;
}
Expand description

The source of physical time for an HlcClock.

The clock reads this trait once per event. A test supplies a ManualClock, so the whole state machine runs without a real clock and without a sleep. Production supplies a SystemClock.

An implementor returns the current wall-clock time in microseconds since the Unix epoch. The value should never go backwards, but the clock does not depend on that: the logical time it keeps never goes backwards, whatever the physical clock does.

Required Methods§

Source

fn now_micros(&self) -> i64

The current wall-clock time, in microseconds since the Unix epoch.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<C: PhysicalClock + ?Sized> PhysicalClock for &C

Source§

fn now_micros(&self) -> i64

Source§

impl<C: PhysicalClock + ?Sized> PhysicalClock for Arc<C>

Source§

fn now_micros(&self) -> i64

Implementors§