blob: 701daa16961c488380d4b70b2272385668099f44 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
use libc::clockid_t;
extern "C" {
fn clock_gettime_nsec_np(clock_id: clockid_t) -> u64;
}
const CLOCK_MONOTONIC_RAW: clockid_t = 4;
/// The time from a clock that increments monotonically,
/// tracking the time since an arbitrary point.
///
/// See [`clock_gettime_nsec_np`].
///
/// [`clock_gettime_nsec_np`]: https://opensource.apple.com/source/Libc/Libc-1158.1.2/gen/clock_gettime.3.auto.html
pub fn now_including_suspend() -> u64 {
unsafe { clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW) }
}
|