mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-27 19:10:22 +01:00
Problem: clock_gettime is now defined in macOS 10.12 SDK
Solution: Rename the custom implementation of clock_gettime for macOS to alt_clock_gettime and wrap all usage in preprocessor macros to only enable the alternative version when using macOS <= 10.11. This issue occurs when targeting macOS 10.11 or earlier but using the 10.12 or newer SDK.
This commit is contained in:
@@ -159,7 +159,12 @@ 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
|
||||
alt_clock_gettime(CLOCK_REALTIME, &timeout);
|
||||
#else
|
||||
clock_gettime(CLOCK_REALTIME, &timeout);
|
||||
#endif
|
||||
|
||||
timeout.tv_sec += timeout_ / 1000;
|
||||
timeout.tv_nsec += (timeout_ % 1000) * 1000000;
|
||||
|
||||
Reference in New Issue
Block a user