This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] A steadier steady_clock


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]