[PATCH] Use clock_gettime()'s CLOCK_REALTIME instead of gettimeofday() where possible

hfinkel at anl.gov hfinkel at anl.gov
Wed Mar 11 17:29:54 PDT 2015


In http://reviews.llvm.org/D8253#139038, @mclow.lists wrote:

> > Indeed, I added _LIBCPP_HAS_NO_MONOTONIC_CLOCK for exactly the situation @hfinkel describes: my platform doesn't have access to a monotonic clock.
>
>
> Note that if you don't have a monotonic clock, none of the thread/mutex/etc stuff will compile.
>  The only way that @jroelofs does this is to also define _LIBCPP_HAS_NO_THREADS.
>
> The C++ standard *requires* that an implementation have a monotonic clock.


Sure, but that has little to do with what POSIX calls its 'monotonic clock'. On some systems, the POSIX 'real time' clock *is* monotonic (because the system has no facilities for changing the time in a non-monotonic way). You need to employ system-specific knowledge to know that's the case, but on those systems, using the real-time clock is appropriate (and sometimes the only thing possible).


http://reviews.llvm.org/D8253

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list