Skip to main content

InstanceClock

Trait InstanceClock 

Source
pub trait InstanceClock: Send + Sync {
    // Required methods
    fn now(&self) -> Stamp;
    fn unix_time(&self) -> Option<(u64, u32)>;
}
Expand description

The instance’s clock, created once by build() through RuntimeOps::new_clock.

The one source of time reads: two time sources with distinct guarantees.

Required Methods§

Source

fn now(&self) -> Stamp

Monotonic, instance-relative: time since the clock was created. Nondecreasing (consecutive readings may be equal); saturates at u64::MAX.

Source

fn unix_time(&self) -> Option<(u64, u32)>

Absolute wall-clock time as (seconds, nanoseconds) since the Unix epoch. Independent of now’s origin: it may be adjusted (clock corrections) and is None where the platform has no wall clock (e.g. a bare MCU with no RTC anchor). Never derive it from a stamp.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§