Skip to main content

Clock

Trait Clock 

Source
pub trait Clock {
    // Required method
    fn unix_now(&self) -> u64;

    // Provided method
    fn unix_now_plus(&self, offset: Duration) -> u64 { ... }
}
Expand description

A source of the current wall-clock time, expressed as seconds since the Unix epoch (UTC). Implementations must be infallible and must return a non-decreasing value in production.

Required Methods§

Source

fn unix_now(&self) -> u64

Current time as seconds since the Unix epoch (UTC).

Provided Methods§

Source

fn unix_now_plus(&self, offset: Duration) -> u64

Convenience: current time plus offset.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§