externally-driven-async-rt 0.4.0

Async runtime that is meant to be embedded
Documentation
1
2
3
4
5
6
7
8
9
10
use rustix::time::{ClockId, clock_gettime};

#[must_use]
pub(crate) fn monotonic_nanos() -> u64 {
    let time = clock_gettime(ClockId::Monotonic);
    time.tv_sec
        .cast_unsigned()
        .saturating_mul(1_000_000_000)
        .saturating_add(u64::try_from(time.tv_nsec).unwrap_or_default())
}