|
Last change
on this file since 2527 was 2036, checked in by bird, 20 years ago |
|
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
|
File size:
753 bytes
|
| Line | |
|---|
| 1 | /* Timer test using the monotonic clock. */
|
|---|
| 2 |
|
|---|
| 3 | #include <time.h>
|
|---|
| 4 | #include <unistd.h>
|
|---|
| 5 |
|
|---|
| 6 | #if defined CLOCK_MONOTONIC && defined _POSIX_MONOTONIC_CLOCK
|
|---|
| 7 |
|
|---|
| 8 | # define TEST_CLOCK CLOCK_MONOTONIC
|
|---|
| 9 | # define TEST_CLOCK_MISSING(clock) \
|
|---|
| 10 | (setup_test () ? "CLOCK_MONOTONIC" : NULL)
|
|---|
| 11 |
|
|---|
| 12 | # include <stdio.h>
|
|---|
| 13 |
|
|---|
| 14 | static int
|
|---|
| 15 | setup_test (void)
|
|---|
| 16 | {
|
|---|
| 17 | if (sysconf (_SC_MONOTONIC_CLOCK) <= 0)
|
|---|
| 18 | return 1;
|
|---|
| 19 |
|
|---|
| 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)
|
|---|
| 24 | {
|
|---|
| 25 | printf ("timer_create: %m\n");
|
|---|
| 26 | return 1;
|
|---|
| 27 | }
|
|---|
| 28 | timer_delete (t);
|
|---|
| 29 |
|
|---|
| 30 | return 0;
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | # include "tst-timer4.c"
|
|---|
| 34 |
|
|---|
| 35 | #else
|
|---|
| 36 | # define TEST_FUNCTION 0
|
|---|
| 37 | # include "../test-skeleton.c"
|
|---|
| 38 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.