C2x scanf binary constant handling
[glibc.git] / time / clocktest.c
blob779c05d8d95a14fcb074ba8810fbf90b26cf1229
1 #include <signal.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <time.h>
5 #include <unistd.h>
6 #include <stdint.h>
8 volatile int gotit = 0;
10 static void
11 alarm_handler (int signal)
13 gotit = 1;
17 int
18 main (int argc, char ** argv)
20 clock_t start, stop;
22 if (signal(SIGALRM, alarm_handler) == SIG_ERR)
24 perror ("signal");
25 exit (1);
27 alarm(1);
28 start = clock ();
29 while (!gotit);
30 stop = clock ();
32 printf ("%jd clock ticks per second (start=%jd,stop=%jd)\n",
33 (intmax_t) (stop - start), (intmax_t) start, (intmax_t) stop);
34 printf ("CLOCKS_PER_SEC=%jd, sysconf(_SC_CLK_TCK)=%ld\n",
35 (intmax_t) CLOCKS_PER_SEC, sysconf(_SC_CLK_TCK));
36 return 0;