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

Ed Schouten ed at nuxi.nl
Wed Mar 11 09:04:35 PDT 2015


================
Comment at: src/chrono.cpp:42
@@ -35,2 +41,3 @@
+#endif  // __APPLE__
 }
 
----------------
mclow.lists wrote:
> Apple does not provide `clock_gettime`, but It's not clear to me that this should be an "Apple vs. everyone else" test.
> 
> Are there other systems that do not provide that call?
While reading the code I assumed that every operating system supported by this source file except OS X had `clock_gettime`, but I forgot to take into account that the monotonic clock is optional through a compilation switch `_LIBCPP_HAS_NO_MONOTONIC_CLOCK`.

The updated patch no longer makes this false assumption. It will only call `clock_gettime` when `CLOCK_REALTIME` or `CLOCK_MONOTONIC` are set.

http://reviews.llvm.org/D8253

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






More information about the cfe-commits mailing list