2.9
[glibc/nacl-glibc.git] / rt / tst-timer5.c
blob6466c8efc15751b8945de66909f9e2d97af6c489
1 /* Timer test using the monotonic clock. */
3 #include <time.h>
4 #include <unistd.h>
6 #if defined CLOCK_MONOTONIC && defined _POSIX_MONOTONIC_CLOCK
8 # define TEST_CLOCK CLOCK_MONOTONIC
9 # define TEST_CLOCK_MISSING(clock) \
10 (setup_test () ? "CLOCK_MONOTONIC" : NULL)
12 # include <stdio.h>
14 static int
15 setup_test (void)
17 if (sysconf (_SC_MONOTONIC_CLOCK) <= 0)
18 return 1;
20 /* The user-level timers implementation doesn't support CLOCK_MONOTONIC,
21 even though sysconf claims it will. */
22 timer_t t;
23 if (timer_create (TEST_CLOCK, NULL, &t) != 0)
25 printf ("timer_create: %m\n");
26 return 1;
28 timer_delete (t);
30 return 0;
33 # include "tst-timer4.c"
35 #else
36 # define TEST_FUNCTION 0
37 # include "../test-skeleton.c"
38 #endif