convert_instant

Function convert_instant 

Source
pub const fn convert_instant<const NOM: u32, const DENOM: u32>(
    now: EPInstantGeneric<NOM, DENOM>,
) -> EPInstant
Expand description

Converts an instant of an unknown fraction NOM/DENOM to our microsecond representation.

This function is useful when implementing EmbeddedProfiler::read_clock, to convert from your clocks native resolution to the 1µs resolution it needs.

let my_clock_instant = EPInstantGeneric::<1, 1_000>::from_ticks(100);
let converted_instant = convert_instant::<1, 1_000>(my_clock_instant);
assert_eq!(100_000, converted_instant.ticks());