[PATCH] A steadier steady_clock
Ulrich Drepper
drepper@gmail.com
Sun Oct 21 23:33:00 GMT 2012
On Sun, Oct 21, 2012 at 12:11 PM, Paolo Carlini
<paolo.carlini@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.
More information about the Libstdc++
mailing list