pub trait Monotonic {
type Instant: Copy + Ord + Sub;
// Required methods
fn ratio() -> Fraction;
fn now() -> Self::Instant;
unsafe fn reset();
fn zero() -> Self::Instant;
}Expand description
A monotonic clock / counter
Required Associated Types§
Required Methods§
Sourcefn ratio() -> Fraction
fn ratio() -> Fraction
The ratio between the system timer (SysTick) frequency and this clock frequency, i.e.
Monotonic clock * Fraction = System clock
The ratio must be expressed in reduced Fraction form to prevent overflows. That is
2 / 3 instead of 4 / 6
Sourcefn now() -> Self::Instant
fn now() -> Self::Instant
Returns the current time
§Correctness
This function is allowed to return nonsensical values if called before reset is invoked
by the runtime. Therefore application authors should not call this function during the
#[init] phase.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.