3 /* Checks for the RS/6000 AIX adjtime() bug, in which if a negative
4 * offset is given, the system gets messed up and never completes the
5 * adjustment. If the problem is fixed, this program will print the
6 * time, sit there for 10 seconds, and exit. If the problem isn't fixed,
7 * the program will print an occasional "result=nnnnnn" (the residual
8 * slew from adjtime()).
10 * Compile this with bsdcc and run it as root!
18 struct timeval adjustment
, result
;
26 struct itimerval value
, oldvalue
;
31 printf("Starting: %s", ctime(&curtime
));
32 value
.it_interval
.tv_sec
= value
.it_value
.tv_sec
= 1;
33 value
.it_interval
.tv_usec
= value
.it_value
.tv_usec
= 0;
34 adjustment
.tv_sec
= 0;
35 adjustment
.tv_usec
= -2000;
36 signal(SIGALRM
, timeout
);
37 setitimer(ITIMER_REAL
, &value
, &oldvalue
);
38 for (i
=0; i
<10; i
++) {
47 struct sigcontext
*scp
50 signal (SIGALRM
, timeout
);
51 if (adjtime(&adjustment
, &result
))
52 printf("adjtime call failed\n");
53 if (result
.tv_sec
!= 0 || result
.tv_usec
!= 0) {
54 printf("result.u = %d.%06.6d ", (int) result
.tv_sec
,
55 (int) result
.tv_usec
);