9.64 clock

#define CLOCK_REALTIME  0
#define CLOCK_MONOTONIC 1
#define CLOCK_GETRES    0
#define CLOCK_GETTIME   1
#define CLOCK_SETTIME   2

int clock(int operation, int clock_id, struct timespec *time);

This syscall fetches or sets epoch dates for each of the supported clocks. Clock is passed in clock_id, with the following values.

CLOCK_REALTIME

Wall-clock, may jump forward and back thanks to time setting.

CLOCK_MONOTONIC

Clock that only moves forward, and is unaffected by NTP or adjustements. It starts from an unspecified, target-dependent point in time, usually boot.

Unlike Linux, it is still counted during suspend.

operation specifies what to do, as such:

CLOCK_GETRES

Load the resolution of the passed clock on the contents of time.

CLOCK_GETTIME

Load the epoch date of the passed clock on the contents of time.

CLOCK_SETTIME

Set the epoch date of the passed clock to the contents of time, not supported for CLOCK_MONOTONIC. Underlying hardware will always be updated.

The syscall returns 0 on success or -1 on failure, with the following errno:

EFAULT

time points to non accessible memory.

EINVAL

One of the passed values is not valid.