Skip to main content

sys_clock_gettime

Function sys_clock_gettime 

Source
pub fn sys_clock_gettime(
    clock_id: u32,
    tp_ptr: u64,
) -> Result<u64, SyscallError>
Expand description

SYS_CLOCK_GETTIME: Get current time for the specified clock.

§Arguments

  • clock_id - Clock identifier (CLOCK_MONOTONIC or CLOCK_REALTIME)
  • tp_ptr - Pointer to userspace timespec structure to fill

§Returns

  • 0 on success
  • -EINVAL if clock_id is invalid
  • -EFAULT if tp_ptr is invalid

§POSIX compatibility

This follows the POSIX signature: int clock_gettime(clockid_t clock_id, struct timespec *tp)