Skip to main content

Timer

Trait Timer 

Source
pub trait Timer {
    // Required methods
    fn now(&self) -> SystemTime;
    fn wait(&self, duration: Duration);
}
Expand description

Wall-clock time, and the ability to wait for some of it.

Deliberately not crate::env::Clock: that answers “what day is it” when resolving which puzzle to work on, whereas throttling needs instants and sleeps.

Required Methods§

Source

fn now(&self) -> SystemTime

The current wall-clock time.

Source

fn wait(&self, duration: Duration)

Blocks the calling thread for the given duration.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§