diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-12-08 09:24:02 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-12-08 09:24:02 -0500 |
commit | 021fdd39e4ebbe8ddee9b10823af76fbb11e7878 (patch) | |
tree | 993dd4ef79f5d5deb3dd48777ea7b50f18843a6e /src/common/compat_time.h | |
parent | afceb431ed3a1c4daf303e5245a05f800d596fa6 (diff) | |
download | tor-021fdd39e4ebbe8ddee9b10823af76fbb11e7878.tar.gz tor-021fdd39e4ebbe8ddee9b10823af76fbb11e7878.zip |
Use mach_approximate_time() for coarse time where available.
This lets us have a coarse-time implementation with reasonable
performance characteristics on OSX and iOS.
Implements 24427.
Diffstat (limited to 'src/common/compat_time.h')
-rw-r--r-- | src/common/compat_time.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/compat_time.h b/src/common/compat_time.h index 462dceccea..bcf469e270 100644 --- a/src/common/compat_time.h +++ b/src/common/compat_time.h @@ -65,6 +65,9 @@ typedef struct monotime_t { typedef struct monotime_coarse_t { uint64_t tick_count_; } monotime_coarse_t; +#elif defined(__APPLE__) && defined(HAVE_MACH_APPROXIMATE_TIME) +#define MONOTIME_COARSE_FN_IS_DIFFERENT +#define monotime_coarse_t monotime_t #else #define monotime_coarse_t monotime_t #endif /* defined(CLOCK_MONOTONIC_COARSE) && ... || ... */ |