]> git.ipfire.org Git - thirdparty/glibc.git/blame - time/clocktest.c
Update.
[thirdparty/glibc.git] / time / clocktest.c
CommitLineData
84724245 1#include <signal.h>
28f540f4
RM
2#include <stdio.h>
3#include <time.h>
84724245 4#include <unistd.h>
28f540f4 5
84724245
RM
6volatile int gotit = 0;
7
8void
9alarm_handler (int signal)
10{
11 gotit = 1;
12}
13
14
15int
16main (int argc, char ** argv)
28f540f4 17{
84724245 18 clock_t start, stop;
28f540f4 19
84724245
RM
20 signal(SIGALRM, alarm_handler);
21 alarm(1);
22 start = clock ();
23 while (!gotit);
24 stop = clock ();
28f540f4 25
84724245
RM
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));
28f540f4
RM
30 return 0;
31}