Skip to main content

nros_platform_clock_ns

Function nros_platform_clock_ns 

Source
pub unsafe extern "C" fn nros_platform_clock_ns() -> u64
Expand description

Monotonic nanoseconds since a platform-defined epoch (boot, program start, …). Never decreases. Wraps after ~584 years.

Must be backed by a hardware counter or the OS tick — never by a software counter that only advances when polled.

Available immediately after platform init, before any other nros subsystem. SHOULD be callable from an ISR; a port whose clock is not ISR-safe must say so in its port documentation.

RFC-0073: this replaced the former clock_ms / clock_us pair. Ports that can convert without a runtime division should — where the counter frequency divides 1e9 (25/50/100/125/200/250 MHz) a compile-time ns-per-cycle multiply is ~2.5x cheaper than the divide it replaces.