Skip to content

Commit

Permalink
Merge pull request #16593 from protocolbuffers/cp-19
Browse files Browse the repository at this point in the history
remove use of mach_absolute_time (#15554)
  • Loading branch information
zhangskz committed Apr 26, 2024
2 parents 86e94ac + 89f1657 commit fd15ad2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/google/protobuf/map.h
Expand Up @@ -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>
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit fd15ad2

Please sign in to comment.