Skip to content

Commit 76d05d4

Browse files
dmaclachzhangskz
authored andcommitted
remove use of mach_absolute_time (#15554)
`mach_absolute_time` is one of Apple's required reason APIs (https://developer.apple.com/documentation/kernel/1462446-mach_absolute_time?language=objc). Replace it with the suggested `clock_gettime_nsec_np(CLOCK_UPTIME_RAW)` so that we don't need a RRA entry in a privacy manifest. issue #15029 Closes #15554 COPYBARA_INTEGRATE_REVIEW=#15554 from protocolbuffers:dmaclach-mach_absolute_time 295d831 PiperOrigin-RevId: 601370915
1 parent 971fbf6 commit 76d05d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/google/protobuf/map.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <utility>
2626

2727
#if !defined(GOOGLE_PROTOBUF_NO_RDTSC) && defined(__APPLE__)
28-
#include <mach/mach_time.h>
28+
#include <time.h>
2929
#endif
3030

3131
#include "google/protobuf/stubs/common.h"
@@ -691,7 +691,7 @@ class PROTOBUF_EXPORT UntypedMapBase {
691691
#if defined(__APPLE__)
692692
// Use a commpage-based fast time function on Apple environments (MacOS,
693693
// iOS, tvOS, watchOS, etc).
694-
s += mach_absolute_time();
694+
s = clock_gettime_nsec_np(CLOCK_UPTIME_RAW);
695695
#elif defined(__x86_64__) && defined(__GNUC__)
696696
uint32_t hi, lo;
697697
asm volatile("rdtsc" : "=a"(lo), "=d"(hi));

0 commit comments

Comments
 (0)