Skip to content

Instantly share code, notes, and snippets.

@abelino
Last active December 7, 2016 19:27
Show Gist options
  • Save abelino/bc063ff71cf35a640f39f439adb648ac to your computer and use it in GitHub Desktop.
Save abelino/bc063ff71cf35a640f39f439adb648ac to your computer and use it in GitHub Desktop.
diff --git a/src/clock.cpp b/src/clock.cpp
index a225e77..0a7404e 100644
--- a/src/clock.cpp
+++ b/src/clock.cpp
@@ -153,9 +153,11 @@ uint64_t zmq::clock_t::now_us ()
// Use POSIX clock_gettime function to get precise monotonic time.
struct timespec tv;
-#if defined ZMQ_HAVE_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 // less than macOS 10.12
+#if defined ZMQ_HAVE_OSX && MAC_OS_X_VERSION_MIN_REQUIRED < 101200 // less than macOS 10.12
+ printf("using alt_clock_gettime\n");
int rc = alt_clock_gettime (CLOCK_MONOTONIC, &tv);
#else
+ printf("using clock_gettime\n");
int rc = clock_gettime (CLOCK_MONOTONIC, &tv);
#endif
// Fix case where system has clock_gettime but CLOCK_MONOTONIC is not supported.
diff --git a/src/condition_variable.hpp b/src/condition_variable.hpp
index d8c8095..cb1b49d 100644
--- a/src/condition_variable.hpp
+++ b/src/condition_variable.hpp
@@ -213,9 +213,11 @@ namespace zmq
if (timeout_ != -1) {
struct timespec timeout;
-#if defined ZMQ_HAVE_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 // less than macOS 10.12
+#if defined ZMQ_HAVE_OSX && MAC_OS_X_VERSION_MIN_REQUIRED < 101200 // less than macOS 10.12
+ printf("using alt_clock_gettime\n");
alt_clock_gettime(CLOCK_REALTIME, &timeout);
#else
+ printf("using clock_gettime\n");
clock_gettime(CLOCK_REALTIME, &timeout);
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment