Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
0d032c99
Commit
0d032c99
authored
Oct 28, 2016
by
Luca Boccassi
Committed by
GitHub
Oct 28, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2176 from robertcastle/master
clock_gettime is now defined in macOS 10.12 SDK
parents
2e926435
0dfb32a2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
+12
-2
clock.cpp
src/clock.cpp
+6
-1
clock.hpp
src/clock.hpp
+1
-1
condition_variable.hpp
src/condition_variable.hpp
+5
-0
No files found.
src/clock.cpp
View file @
0d032c99
...
...
@@ -58,7 +58,7 @@
#include <time.h>
#include <sys/time.h>
int
clock_gettime
(
int
clock_id
,
timespec
*
ts
)
int
alt_
clock_gettime
(
int
clock_id
,
timespec
*
ts
)
{
// The clock_id specified is not supported on this system.
if
(
clock_id
!=
CLOCK_REALTIME
)
{
...
...
@@ -152,7 +152,12 @@ 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
int
rc
=
alt_clock_gettime
(
CLOCK_MONOTONIC
,
&
tv
);
#else
int
rc
=
clock_gettime
(
CLOCK_MONOTONIC
,
&
tv
);
#endif
// Fix case where system has clock_gettime but CLOCK_MONOTONIC is not supported.
// This should be a configuration check, but I looked into it and writing an
// AC_FUNC_CLOCK_MONOTONIC seems beyond my powers.
...
...
src/clock.hpp
View file @
0d032c99
...
...
@@ -37,7 +37,7 @@
#include <mach/mach.h>
#include <time.h>
#include <sys/time.h>
int
clock_gettime
(
int
clock_id
,
timespec
*
ts
);
int
alt_
clock_gettime
(
int
clock_id
,
timespec
*
ts
);
#ifndef CLOCK_REALTIME
#define CLOCK_REALTIME 0
#endif
...
...
src/condition_variable.hpp
View file @
0d032c99
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment