pub trait Clock: Sized + Debug {
    // Required method
    fn try_now(&self) -> Result<Instant, ClockError>;

    // Provided methods
    fn new_delay(&self) -> Delay<'_, Self>
       where Self: Sized { ... }
    fn new_timer(&self) -> Timer<'_, Self> { ... }
    fn new_timer_running(&self, duration: Duration) -> Timer<'_, Self> { ... }
}
Expand description

Implement this trait for your Clock(s). The time is measured since the start of the application, using a alias to the core::time::Duration type.

Required Methods§

source

fn try_now(&self) -> Result<Instant, ClockError>

Try to get the time since the application started

Provided Methods§

source

fn new_delay(&self) -> Delay<'_, Self>
where Self: Sized,

Generate a new DelayMS + DelayUS Delay

source

fn new_timer(&self) -> Timer<'_, Self>

Generate a new timer

source

fn new_timer_running(&self, duration: Duration) -> Timer<'_, Self>

Generate and start a new timer

Object Safety§

This trait is not object safe.

Implementors§