Expand description
Clock API for nros
This module provides clock abstraction for different time sources:
- SystemTime: Wall clock time (affected by system time changes)
- SteadyTime: Monotonic time (not affected by system time changes)
- RosTime: Simulation time (can be paused/scaled)
§Example
use nros::clock::{Clock, ClockType};
// Create a system clock
let clock = Clock::system();
let now = clock.now();
println!("Current time: {} sec", now.sec);
// Create a steady clock for measuring durations
let clock = Clock::steady();
let start = clock.now();
// ... do work ...
let elapsed = clock.now() - start;§no_std Support
Without the std feature, clocks return time based on an internal
counter that must be updated manually via update_time(). This is
suitable for embedded systems with RTIC or bare-metal polling loops.
Structs§
- Clock
- A clock for querying time
Enums§
- Clock
Type - Type of clock to use for time queries