use crate::backend::c;
use crate::fd::BorrowedFd;
#[cfg(not(any(apple, target_os = "wasi")))]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(not(target_os = "dragonfly"), repr(i32))]
#[cfg_attr(target_os = "dragonfly", repr(u64))]
#[non_exhaustive]
pub enum ClockId {
Realtime = c::CLOCK_REALTIME,
Monotonic = c::CLOCK_MONOTONIC,
#[cfg(any(freebsdlike, target_os = "openbsd"))]
Uptime = c::CLOCK_UPTIME,
#[cfg(not(any(solarish, target_os = "netbsd", target_os = "redox")))]
ProcessCPUTime = c::CLOCK_PROCESS_CPUTIME_ID,
#[cfg(not(any(solarish, target_os = "netbsd", target_os = "redox")))]
ThreadCPUTime = c::CLOCK_THREAD_CPUTIME_ID,
#[cfg(any(linux_kernel, target_os = "freebsd"))]
RealtimeCoarse = c::CLOCK_REALTIME_COARSE,
#[cfg(any(linux_kernel, target_os = "freebsd"))]
MonotonicCoarse = c::CLOCK_MONOTONIC_COARSE,
#[cfg(linux_kernel)]
MonotonicRaw = c::CLOCK_MONOTONIC_RAW,
}
#[cfg(apple)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
#[repr(u32)]
#[non_exhaustive]
pub enum ClockId {
Realtime = c::CLOCK_REALTIME,
Monotonic = c::CLOCK_MONOTONIC,
ProcessCPUTime = c::CLOCK_PROCESS_CPUTIME_ID,
ThreadCPUTime = c::CLOCK_THREAD_CPUTIME_ID,
}
#[cfg(not(target_os = "wasi"))]
#[derive(Debug, Copy, Clone)]
#[non_exhaustive]
pub enum DynamicClockId<'a> {
Known(ClockId),
Dynamic(BorrowedFd<'a>),
#[cfg(linux_kernel)]
RealtimeAlarm,
#[cfg(linux_kernel)]
Tai,
#[cfg(any(linux_kernel, target_os = "openbsd"))]
Boottime,
#[cfg(linux_kernel)]
BoottimeAlarm,
}