Commit 8ad9e74f authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺 Committed by Ben Gamari
Browse files

Make `timer_create(CLOCK_REALTIME)` autoconf test more reliable

I've noticed that on a platform with a coarse timer/scheduling
granularity of 10ms this autoconf tests fails to detect a working

On AIX, this effectively means that intervals/timers are rounded up to
multiples of 10ms, so a 13ms delay is effectively a 20ms delay.

By using a 100ms timeout we are on the safe side.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, erikd

Differential Revision:
parent b3d6c0f7
...@@ -1591,17 +1591,18 @@ int main(int argc, char *argv[]) ...@@ -1591,17 +1591,18 @@ int main(int argc, char *argv[])
exit(2); exit(2);
} }
tock = 0;
it.it_value.tv_sec = 0; it.it_value.tv_sec = 0;
it.it_value.tv_nsec = 1000000; it.it_value.tv_nsec = 1000000; // 1ms
it.it_interval = it.it_value; it.it_interval = it.it_value;
if (timer_settime(timer, 0, &it, NULL) != 0) { if (timer_settime(timer, 0, &it, NULL) != 0) {
fprintf(stderr,"settime problem\n"); fprintf(stderr,"settime problem\n");
exit(4); exit(4);
} }
tock = 0; // some environments have coarse scheduler/timer granularity of ~10ms and worse
usleep(100000); // 100ms
if (!tock) { if (!tock) {
fprintf(stderr,"no CLOCK_REALTIME signal\n"); fprintf(stderr,"no CLOCK_REALTIME signal\n");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment