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

Jonathan Roelofs jonathan at codesourcery.com
Wed Mar 11 09:20:20 PDT 2015


Please upload your diffs with more context (i.e. `git diff -U999`)... it'll make the reviews a bit easier.

How about defining `_LIBCPP_HAS_NO_REALTIME_CLOCK`, similarly to the existing one for monotonic clocks in `include/__config` under the appropriate guards? (i.e. it would be defined on `__APPLE__`, and anywhere else that doesn't have `clock_gettime(CLOCK_REALTIME, x)`)


================
Comment at: src/chrono.cpp:72
@@ -53,2 +71,3 @@
 
-#ifdef __APPLE__
+#ifdef CLOCK_MONOTONIC
+
----------------
This is already taken care of where `_LIBCPP_HAS_NO_MONOTONIC_CLOCK` is defined. I don't think there's a need to change anything around the steady_clock implementation.

http://reviews.llvm.org/D8253

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






More information about the cfe-commits mailing list