[][src]Trait kernel::hil::time::Time

pub trait Time {
    type Frequency: Frequency;
    type Ticks: Ticks;
    fn now(&self) -> Self::Ticks;

    fn ticks_from_seconds(s: u32) -> Self::Ticks { ... }
fn ticks_from_ms(ms: u32) -> Self::Ticks { ... }
fn ticks_from_us(us: u32) -> Self::Ticks { ... } }

Represents a moment in time, obtained by calling now.

Associated Types

type Frequency: Frequency

The number of ticks per second

type Ticks: Ticks

The width of a time value

Loading content...

Required methods

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

Returns a timestamp. Depending on the implementation of Time, this could represent either a static timestamp or a sample of a counter; if an implementation relies on it being constant or changing it should use Timestamp or Counter.

Loading content...

Provided methods

fn ticks_from_seconds(s: u32) -> Self::Ticks

Returns the number of ticks in the provided number of seconds, rounding down any fractions. If the value overflows Ticks it returns Ticks::max_value().

fn ticks_from_ms(ms: u32) -> Self::Ticks

Returns the number of ticks in the provided number of milliseconds, rounding down any fractions. If the value overflows Ticks it returns Ticks::max_value().

fn ticks_from_us(us: u32) -> Self::Ticks

Returns the number of ticks in the provided number of microseconds, rounding down any fractions. If the value overflows Ticks it returns Ticks::max_value().

Loading content...

Implementors

Loading content...