Update.
[glibc.git] / time / clocktest.c
blob65cd938643c6f45550641097c67cd3de153b21dd
1 #include <signal.h>
2 #include <stdio.h>
3 #include <time.h>
4 #include <unistd.h>
6 volatile int gotit = 0;
8 void
9 alarm_handler (int signal)
11 gotit = 1;
15 int
16 main (int argc, char ** argv)
18 clock_t start, stop;
20 if (signal(SIGALRM, alarm_handler) == SIG_ERR)
22 perror ("signal");
23 exit (1);
25 alarm(1);
26 start = clock ();
27 while (!gotit);
28 stop = clock ();
30 printf ("%ld clock ticks per second (start=%ld,stop=%ld)\n",
31 stop - start, start, stop);
32 printf ("CLOCKS_PER_SEC=%d, sysconf(_SC_CLK_TCK)=%ld\n",
33 CLOCKS_PER_SEC, sysconf(_SC_CLK_TCK));
34 return 0;