aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhangskz <sandyzhang@google.com>2024-04-26 10:57:47 -0400
committerGitHub <noreply@github.com>2024-04-26 10:57:47 -0400
commitfd15ad2b126298e21edbf4f48fb81b83d6a4b054 (patch)
treed1c55bb275ada5b8d71ae46b2077e74fc48d3b32
parent86e94aced6a7fec0fac38b0331561e40a8c0ba6a (diff)
parent89f1657e8bcea1322374d973f915b4cf8c1deb49 (diff)
downloadprotobuf-upstream-3.19.x.tar.gz
Merge pull request #16593 from protocolbuffers/cp-19upstream-3.19.x
remove use of mach_absolute_time (#15554)
-rw-r--r--src/google/protobuf/map.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h
index 0708366c6..3d56a4c17 100644
--- a/src/google/protobuf/map.h
+++ b/src/google/protobuf/map.h
@@ -51,7 +51,7 @@
#endif // defined(__cpp_lib_string_view)
#if !defined(GOOGLE_PROTOBUF_NO_RDTSC) && defined(__APPLE__)
-#include <mach/mach_time.h>
+#include <time.h>
#endif
#include <google/protobuf/stubs/common.h>
@@ -1088,7 +1088,7 @@ class Map {
#if defined(__APPLE__)
// Use a commpage-based fast time function on Apple environments (MacOS,
// iOS, tvOS, watchOS, etc).
- s += mach_absolute_time();
+ s = clock_gettime_nsec_np(CLOCK_UPTIME_RAW);
#elif defined(__x86_64__) && defined(__GNUC__)
uint32_t hi, lo;
asm volatile("rdtsc" : "=a"(lo), "=d"(hi));