HP-UX Reference (11i v2 04/09) - 2 System Calls (vol 5)

a
adjtime(2) adjtime(2)
[EINVAL] If delta.tv_sec is greater than 31536000 (approx. 365 days) or less than 31536000.
The delta.tv_usec field is not used in calculation of these limits. If the user wants to
adjust time greater than these limits, an appropriate alternative interface should be
used.
EXAMPLES
The following code snippet will take the time forward 20 minutes.
struct timeval forward;
forward.tv_sec = 20 * 60; /* 20 minutes */
forward.tv_usec = 0;
if (adjtime(&forward, (struct timeval *)NULL) == -1)
perror("adjtime() failure");
/*
* If adjtime() succeeds, the system time will move forward
* 20 minutes over a period of time.
*/
The following code fragment will repeatedly call a user-defined function
adjustment_still_in_progress()
until the adjustment requested in a previous call to adj-
time() (called from either the same process or another process) is completed.
struct timeval report;
if (adjtime((struct timeval *)NULL, &report) == -1)
perror("adjtime() failure");
while (report.tv_sec || report.tv_usec) {
adjustment_still_in_progress();
if (adjtime((struct timeval *)NULL, &report) == -1)
perror("adjtime() failure");
}
AUTHOR
adjtime() was developed by the University of California, Berkeley and AT&T.
SEE ALSO
date(1), gettimeofday(2), stime(2), clock_settime(2), clocks(2), getitimer(2), setitimer(2), alarm(2).
HP-UX 11i Version 2: September 2004 2 Hewlett-Packard Company Section 213