diff options
Diffstat (limited to 'vendor/rustix/src/time/clock.rs')
-rw-r--r-- | vendor/rustix/src/time/clock.rs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/vendor/rustix/src/time/clock.rs b/vendor/rustix/src/time/clock.rs index f76e3fa18..1bf74d60b 100644 --- a/vendor/rustix/src/time/clock.rs +++ b/vendor/rustix/src/time/clock.rs @@ -14,7 +14,7 @@ pub use backend::time::types::{ClockId, DynamicClockId}; /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html /// [Linux]: https://man7.org/linux/man-pages/man2/clock_getres.2.html -#[cfg(any(not(any(target_os = "redox", target_os = "wasi"))))] +#[cfg(not(any(target_os = "redox", target_os = "wasi")))] #[inline] #[must_use] pub fn clock_getres(id: ClockId) -> Timespec { @@ -54,3 +54,25 @@ pub fn clock_gettime(id: ClockId) -> Timespec { pub fn clock_gettime_dynamic(id: DynamicClockId<'_>) -> io::Result<Timespec> { backend::time::syscalls::clock_gettime_dynamic(id) } + +/// `clock_settime(id, timespec)`—Sets the current value of a settable clock. +/// +/// This fails with [`io::Errno::INVAL`] if the clock is not settable, and +/// [`io::Errno::ACCESS`] if the current process does not have permission to +/// set it. +/// +/// # References +/// - [POSIX] +/// - [Linux] +/// +/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_settime.html +/// [Linux]: https://man7.org/linux/man-pages/man2/clock_settime.2.html +#[cfg(not(any( + target_os = "redox", + target_os = "wasi", + all(apple, not(target_os = "macos")) +)))] +#[inline] +pub fn clock_settime(id: ClockId, timespec: Timespec) -> io::Result<()> { + backend::time::syscalls::clock_settime(id, timespec) +} |