Skip to main content

WallClock

Trait WallClock 

Source
pub trait WallClock: Send + Sync {
    // Required method
    fn now(&self) -> SystemTime;
}
Expand description

Provides the current civil time as a SystemTime.

Unlike monotonic time, wall time may move backward after a system clock adjustment and must not be used to measure elapsed durations.

Discarding a sampled wall time is rejected when unused_must_use is denied:

#![deny(unused_must_use)]
use qubit_clock::{StdWallClock, WallClock};

StdWallClock::new().now();

Required Methods§

Source

fn now(&self) -> SystemTime

Returns the current wall-clock time.

§Returns

The implementor’s current civil-time reading.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T> WallClock for &T
where T: WallClock + ?Sized,

Source§

fn now(&self) -> SystemTime

Delegates to the borrowed wall clock object.

§Returns

The current wall time returned by the borrowed clock.

Source§

impl<T> WallClock for Arc<T>
where T: WallClock + ?Sized,

Source§

fn now(&self) -> SystemTime

Delegates to the shared wall clock object.

§Returns

The current wall time returned by the wrapped clock.

Source§

impl<T> WallClock for Box<T>
where T: WallClock + ?Sized,

Source§

fn now(&self) -> SystemTime

Delegates to the boxed wall clock object.

§Returns

The current wall time returned by the wrapped clock.

Implementors§