Skip to main content

Clock

Trait Clock 

Source
pub trait Clock {
    // Required method
    fn now(&self) -> u64;
}
Expand description

A source of monotonic time, expressed as a u64 tick.

The unit is whatever the clock uses (milliseconds is typical) and must match the unit you pass to the resilience policies. Implementations should be monotonic non-decreasing, though Reliakit’s policies all saturate and so do not panic if a clock moves backwards.

Required Methods§

Source

fn now(&self) -> u64

Returns the current time as a u64 tick.

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: Clock + ?Sized> Clock for &C

Source§

fn now(&self) -> u64

Implementors§

Source§

impl Clock for ManualClock

Source§

impl Clock for MonotonicClock

Available on crate feature std only.