#platform #naive #timer

no-std naive-timer

A minimal naive timer for embedded (no_std) platforms

2 unstable releases

0.2.0 Aug 8, 2021
0.1.0 Jun 23, 2020

#625 in Embedded development

Download history 150741/week @ 2025-11-21 89255/week @ 2025-11-28 263364/week @ 2025-12-05 237422/week @ 2025-12-12 85907/week @ 2025-12-19 30147/week @ 2025-12-26 169808/week @ 2026-01-02 304169/week @ 2026-01-09 357343/week @ 2026-01-16 115065/week @ 2026-01-23 27247/week @ 2026-01-30 36512/week @ 2026-02-06 30715/week @ 2026-02-13 37628/week @ 2026-02-20 33246/week @ 2026-02-27 50945/week @ 2026-03-06

166,676 downloads per month
Used in 29 crates (via madsim)

MIT license

7KB
58 lines

naive-timer

Crate Docs Actions Status Coverage Status

A minimal naive timer for embedded platforms in Rust (no_std + alloc).

Example

let mut timer = naive_timer::Timer::default();
let event = Arc::new(AtomicBool::new(false));

// add a timer with callback
timer.add(Duration::from_secs(1), {
    let event = event.clone();
    move |_now| event.store(true, Ordering::SeqCst)
});

// expire timers (usually from timer interrupt)
timer.expire(Duration::from_millis(1000));
assert_eq!(event.load(Ordering::SeqCst), true);
assert_eq!(timer.next(), None);

License

The code in this repository is licensed under the MIT License.

No runtime deps