On Sun, Oct 21, 2012 at 12:11 PM, Paolo Carlini <paolo.carl...@oracle.com> wrote: \>> @@ -70,7 +70,11 @@ >> { >> timespec tp; >> // -EINVAL, -EFAULT >> +#ifdef CLOCK_MONOTONIC_RAW >> + clock_gettime(CLOCK_MONOTONIC_RAW, &tp); >> +#else >> clock_gettime(CLOCK_MONOTONIC, &tp); >> +#endif >> return time_point(duration(chrono::seconds(tp.tv_sec) >> + chrono::nanoseconds(tp.tv_nsec))); >> }
That'll have to be something like #ifdef CLOCK_MONOTONIC_RAW if (clock_gettime(CLOCK_MONOTONIC_RAW, &tp) != 0) #endif clock_gettime(CLOCK_MONOTONIC, &tp); Only way out of this is when you introduce a check for a minimum kernel ABI somewhere, just like glibc does.