pub use core::time::Duration;
pub type TimeValue = Duration;
#[cfg(feature = "irq")]
pub use crate::platform::irq::TIMER_IRQ_NUM;
#[cfg(feature = "irq")]
pub use crate::platform::time::set_oneshot_timer;
pub use crate::platform::time::{current_ticks, nanos_to_ticks, ticks_to_nanos};
pub const MILLIS_PER_SEC: u64 = 1_000;
pub const MICROS_PER_SEC: u64 = 1_000_000;
pub const NANOS_PER_SEC: u64 = 1_000_000_000;
pub const NANOS_PER_MILLIS: u64 = 1_000_000;
pub const NANOS_PER_MICROS: u64 = 1_000;
pub fn current_time_nanos() -> u64 {
ticks_to_nanos(current_ticks())
}
pub fn current_time() -> TimeValue {
TimeValue::from_nanos(current_time_nanos())
}
pub fn busy_wait(dur: Duration) {
busy_wait_until(current_time() + dur);
}
pub fn busy_wait_until(deadline: TimeValue) {
while current_time() < deadline {
core::hint::spin_loop();
}
}