| CLOCK_SETTIME(2) | System Calls Manual | CLOCK_SETTIME(2) | 
clock_settime, clock_gettime,
  clock_getres —
#include <time.h>
int
  
  clock_settime(clockid_t
    clock_id, const struct
    timespec *tp);
int
  
  clock_gettime(clockid_t
    clock_id, struct timespec
    *tp);
int
  
  clock_getres(clockid_t
    clock_id, struct timespec
    *res);
clock_settime() function sets the clock identified
  by clock_id to the absolute time specified by
  tp. If the time specified by tp is
  not a multiple of the resolution of the clock, tp is
  truncated to a multiple of the resolution.
The clock_gettime() function stores the
    time of the clock identified by clock_id into the
    location specified by tp.
The clock_getres() function stores the
    resolution of the clock identified by clock_id into
    the location specified by res, unless
    res is NULL.
The following clock_id values are supported:
CLOCK_REALTIMEclock_settime() and obtained by
      clock_gettime() represent the amount of time (in
      seconds and nanoseconds) since 00:00 Universal Coordinated Time, January
      1, 1970.CLOCK_MONOTONICEINVAL error if it's the clock
      specified in a call to clock_settime(). The origin
      of the clock is unspecified.CLOCK_VIRTUALCLOCK_PROFCLOCK_PROCESS_CPUTIME_IDCLOCK_THREAD_CPUTIME_IDIf the calling user is not the super-user, the
    clock_settime() system call will fail, and the
    clock_settime() function in the standard C library
    will try to use the
    clockctl(4) device if
    present, thus making it possible for non privileged users to set the system
    time. If clockctl(4) is not
    present or not accessible, then clock_settime()
    returns EPERM.
clock_settime(),
  clock_gettime() and
  clock_getres() functions will fail if:
EINVAL]ENOSYS]The clock_settime() function will fail
  if:
EINVAL]EPERM]The clock_gettime() function will fail
  if:
EFAULT]clock_settime(),
  clock_gettime() and
  clock_getres() functions conform to
  IEEE Std 1003.1b-1993 (“POSIX.1b”).
| September 23, 2016 | NetBSD 9.4 |