From d25b9bd495ddf5c8f8d933e47e95b579e5417ad1 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Fri, 19 Dec 2025 00:26:19 +0000 Subject: [PATCH] time: Provide ClockID associated constants for openbsd and netbsd - https://man.openbsd.org/clock_settime.2 - https://man.netbsd.org/clock_gettime.2 There is some constants that have not added here as there are missing in the libc crate. --- src/time.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/time.rs b/src/time.rs index e5287362f6..8b4c2d2a7a 100644 --- a/src/time.rs +++ b/src/time.rs @@ -56,7 +56,12 @@ impl ClockId { self.0 } - #[cfg(any(linux_android, target_os = "emscripten", target_os = "fuchsia"))] + #[cfg(any( + linux_android, + target_os = "emscripten", + target_os = "fuchsia", + target_os = "openbsd", + ))] /// Starts at zero when the kernel boots and increments monotonically in SI seconds while the /// machine is running. pub const CLOCK_BOOTTIME: ClockId = ClockId(libc::CLOCK_BOOTTIME); @@ -89,6 +94,7 @@ impl ClockId { freebsdlike, target_os = "emscripten", target_os = "fuchsia", + target_os = "openbsd", target_os = "redox", ))] /// Returns the execution time of the calling process. @@ -139,11 +145,12 @@ impl ClockId { freebsdlike, target_os = "emscripten", target_os = "fuchsia", + target_os = "openbsd", ))] /// Returns the execution time of the calling thread. pub const CLOCK_THREAD_CPUTIME_ID: ClockId = ClockId(libc::CLOCK_THREAD_CPUTIME_ID); - #[cfg(freebsdlike)] + #[cfg(any(freebsdlike, target_os = "openbsd"))] /// Starts at zero when the kernel boots and increments monotonically in SI seconds while the /// machine is running. pub const CLOCK_UPTIME: ClockId = ClockId(libc::CLOCK_UPTIME);