clock_gettimedrift(3) — Subroutines
Digital
NAME
clock_gettimedrift, clock_settimedrift − get or set the drift rate for the specified clock (POSIX Std P1003.4)
SYNOPSIS
#include <timers.h>
int clock_gettimedrift (
int clock_id ,
int ∗ppb) ;
int clock_settimedrift (
int clock_id ,
const int ppb ,
int ∗oppb) ;
PARAMETERS
clock_id The clock type used to obtain the time or the clock that is set. The CLOCK_REALTIME clock is supported and represents the time-of-day clock for the system.
ppb The specified drift rate to be set by clock_settimedrift or the value returned by a call to clock_gettimedrift. The clock drift rate is specified in parts per billion.
oppb A pointer to an integer that receives the previous clock drift rate.
DESCRIPTION
The clock drift rate for any clock is initially zero, but can be changed by a call to the clock_settimedrift function. The clock_settimedrift function changes the clock drift rate and returns the previous drift rate.
The clock_gettimedrift function returns the current value of the clock drift rate as set by the most recent call to clock_settimedrift.
A drift rate may be varied through an interval centered around zero. For positive drift, the clock will gain time at the specified rate. For negative drift, the clock will lose time at the specified rate.
Note that the clock drift functions should not be used in conjunction with Distributed Time Services (DTS). In addition, you need superuser privileges to use the clock_settimedrift function.
RETURN VALUES
On a successful call, a value of 0 is returned.
On an unsuccessful call, a value of −1 is returned and errno is set to indicate that an error occurred.
ERRORS
The clock_gettimedrift, and clock_settimedrift, functions fail under the following conditions:
[EINVAL] The clock_id argument does not specify a known clock. The ppb argument specified a value outside the range supported by the implementation.
[EPERM] The requesting process does not have the appropriate privilege to set the drift rate.
RELATED INFORMATION
time(1), clock_getres(3), clock_gettime(3), clock_settime(3), ctime(3), timer_gettime(3)