]> git.ipfire.org Git - thirdparty/glibc.git/blame - time/clocktest.c
powerpc: Fix build of wcscpy with --disable-multi-arch
[thirdparty/glibc.git] / time / clocktest.c
CommitLineData
84724245 1#include <signal.h>
28f540f4 2#include <stdio.h>
3e1f480e 3#include <stdlib.h>
28f540f4 4#include <time.h>
84724245 5#include <unistd.h>
ceaa9889 6#include <stdint.h>
28f540f4 7
84724245
RM
8volatile int gotit = 0;
9
de149cdb 10static void
84724245
RM
11alarm_handler (int signal)
12{
13 gotit = 1;
14}
15
16
17int
18main (int argc, char ** argv)
28f540f4 19{
84724245 20 clock_t start, stop;
28f540f4 21
227d9931 22 if (signal(SIGALRM, alarm_handler) == SIG_ERR)
9eb2730e
UD
23 {
24 perror ("signal");
25 exit (1);
26 }
84724245
RM
27 alarm(1);
28 start = clock ();
29 while (!gotit);
30 stop = clock ();
28f540f4 31
fe342f50
L
32 printf ("%jd clock ticks per second (start=%jd,stop=%jd)\n",
33 (intmax_t) (stop - start), (intmax_t) start, (intmax_t) stop);
57ada0e7
L
34 printf ("CLOCKS_PER_SEC=%jd, sysconf(_SC_CLK_TCK)=%ld\n",
35 (intmax_t) CLOCKS_PER_SEC, sysconf(_SC_CLK_TCK));
28f540f4
RM
36 return 0;
37}