Debian Codegraph @

third_party/rust/zeitstempel/src/mac.rs

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