![]() |
![]() |
![]() |
Get or set a clock
#include <sys/neutrino.h> int ClockTime( clockid_t id, const uint64_t * new, uint64_t * old ); int ClockTime_r( clockid_t id, const uint64_t * new, uint64_t * old );
libc
The ClockTime() and ClockTime_r() functions are identical except in the way they indicate errors. See the Returns section for details.
These kernel calls allow you to get or set the system clock specified by id. The clock ID, CLOCK_REALTIME, maintains the system time.
If new isn't NULL, then it contains the absolute time to set the system clock to. This affects the software clock maintained by the system. It won't change any underlying hardware clock which maintains the time when the system is powered off.
Once set, the system time increments by some number of nanoseconds, based upon the resolution of the system clock. This resolution can be queried or changed using the ClockPeriod() kernel call.
Superuser privileges are required to set the clock.
If old isn't NULL, then the current time (before being changed by a non-NULL new) is returned init.
These calls don't block.
The only difference between these functions is the way they indicate errors:
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | No |
![]() |
![]() |
![]() |