MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / clock_getres

Function clock_getres

src/backend/linux_raw/time/syscalls.rs:25–42  ·  view source on GitHub ↗
(id: ClockId)

Source from the content-addressed store, hash-verified

23#[inline]
24#[must_use]
25pub(crate) fn clock_getres(id: ClockId) -> Timespec {
26 #[cfg(target_pointer_width = "32")]
27 unsafe {
28 let mut result = MaybeUninit::<Timespec>::uninit();
29 if let Err(err) = ret(syscall!(__NR_clock_getres_time64, id, &mut result)) {
30 // See the comments in `clock_gettime_via_syscall` about emulation.
31 debug_assert_eq!(err, io::Errno::NOSYS);
32 clock_getres_old(id, &mut result);
33 }
34 result.assume_init()
35 }
36 #[cfg(target_pointer_width = "64")]
37 unsafe {
38 let mut result = MaybeUninit::<Timespec>::uninit();
39 ret_infallible(syscall!(__NR_clock_getres, id, &mut result));
40 result.assume_init()
41 }
42}
43
44#[cfg(target_pointer_width = "32")]
45unsafe fn clock_getres_old(id: ClockId, result: &mut MaybeUninit<Timespec>) {

Callers

nothing calls this directly

Calls 4

assume_initMethod · 0.80
clock_getres_oldFunction · 0.70
retFunction · 0.50
ret_infallibleFunction · 0.50

Tested by

no test coverage detected