Module riot_wrappers::ztimer

source ·
Available on riot_module_ztimer only.
Expand description

§ztimer high level timer

ZTimer clocks are usually obtained by calling constructors that depend on the presence of global clocks – Clock::sec, Clock::msec and Clock::usec.

The methods usable on the clocks typically take durations in the form of Ticks, which ensure that time calculations are done early but can’t be mixed up between clocks. The sleep and spin methods take numeric tick counts and durations, not only for historical reasons, but also because sleeping for a Duration works infallibly (even if the duration exceeds the maximum number of ticks a timer can sleep) by sleeping in repetitions.



  • A clock that knows about its frequency. The pulse length is not given in core::time::Duration as that’s not yet supported by const generics, and because clock rates are often easier to express in Hertz than in multiples of 10^-n seconds.
  • Delayembedded-hal-async and riot_module_ztimer_usec
    Struct that provides the embedded_hal_async::delay::DelayNs trait
  • The error type of fallible conversions to ticks.
  • A duration on a clock of fixed speed