[][src]Trait topq::Timer

pub trait Timer {
    type Time: Ord;

    const TICKS_PER_SECOND: u32;

    fn now(&self) -> Self::Time;
fn wrapping_add(time: &Self::Time, offset: &Self::Time) -> Self::Time; }

A trait that represents a (probably rolling) timer of arbitrary precision.

Associated Types

type Time: Ord

The type that is used to represent a time/offset

Loading content...

Associated Constants

const TICKS_PER_SECOND: u32

The number of ticks per second. e.g. if using a 32.786kHz timer, this would be 32_768

Loading content...

Required methods

fn now(&self) -> Self::Time

Get the current time

fn wrapping_add(time: &Self::Time, offset: &Self::Time) -> Self::Time

Add a timestamp plus an offset. When this type is expected to be rolling (e.g. when using a u32 with a 32.768kHz clock), the addition should be done by wrapping

Loading content...

Implementors

Loading content...