Wed Jun 5 15:57:28 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
[glibc.git] / time / clocktest.c
blob570c194a8163ccf3eb6763a6a52b7295d87311d5
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 signal(SIGALRM, alarm_handler);
21 alarm(1);
22 start = clock ();
23 while (!gotit);
24 stop = clock ();
26 printf ("%ld clock ticks per second (start=%ld,stop=%ld)\n",
27 stop - start, start, stop);
28 printf ("CLOCKS_PER_SEC=%d, sysconf(_SC_CLK_TCK)=%ld\n",
29 CLOCKS_PER_SEC, sysconf(_SC_CLK_TCK));
30 return 0;