Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / ntp / util / testrs6000.c
blob030dfa506a8f9e6cf713bc861fe2ebefd65ce9a7
1 /* $NetBSD$ */
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!
12 #include <signal.h>
13 #include <sys/time.h>
14 #include <time.h>
15 #include <stdio.h>
17 int timeout();
18 struct timeval adjustment, result;
20 int
21 main (
22 int argc,
23 char *argv[]
26 struct itimerval value, oldvalue;
27 int i;
28 time_t curtime;
30 curtime = time(0);
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++) {
39 pause();
43 int
44 timeout(
45 int sig,
46 int code,
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);