Module timer

Module timer 

Source
Expand description

Platform-native timers with high precision.

Leverages OS scheduling primitives (GCD dispatch_after on Apple) for accurate timing without busy-waiting.

use native_executor::timer::{Timer, sleep};
use std::time::Duration;

Timer::after(Duration::from_millis(100)).await;  // Precise timing
Timer::after_secs(2).await;                      // Convenience method  
sleep(1).await;                                  // Simple sleep

Structs§

Timer
A high-precision future that completes after a specified duration.

Functions§

sleep
Suspends the current async task for the specified number of seconds.