Fix working on mac clock_gettime (#292)
* fix working on mac clock_gettime
* Comment fixme
diff --git a/src/timers.cc b/src/timers.cc
index 05c7924..a2c8f0e 100644
--- a/src/timers.cc
+++ b/src/timers.cc
@@ -101,7 +101,8 @@
double ProcessCPUUsage() {
-#if defined(CLOCK_PROCESS_CPUTIME_ID)
+// FIXME We want to use clock_gettime, but its not available in MacOS 10.11. See https://github.com/google/benchmark/pull/292
+#if defined(CLOCK_PROCESS_CPUTIME_ID) && !defined(BENCHMARK_OS_MACOSX)
struct timespec spec;
if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &spec) == 0)
return MakeTime(spec);
@@ -124,7 +125,8 @@
}
double ThreadCPUUsage() {
-#if defined(CLOCK_THREAD_CPUTIME_ID)
+// FIXME We want to use clock_gettime, but its not available in MacOS 10.11. See https://github.com/google/benchmark/pull/292
+#if defined(CLOCK_THREAD_CPUTIME_ID) && !defined(BENCHMARK_OS_MACOSX)
struct timespec ts;
if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) == 0)
return MakeTime(ts);