Skip to content

Commit 295d831

Browse files
authored
remove use of mach_absolute_time
`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 protocolbuffers#15029
1 parent c73fa81 commit 295d831

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/google/protobuf/map.h

Lines changed: 2 additions & 2 deletions
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"
@@ -676,7 +676,7 @@ class PROTOBUF_EXPORT UntypedMapBase {
676676
#if defined(__APPLE__)
677677
// Use a commpage-based fast time function on Apple environments (MacOS,
678678
// iOS, tvOS, watchOS, etc).
679-
s = mach_absolute_time();
679+
s = clock_gettime_nsec_np(CLOCK_UPTIME_RAW);
680680
#elif defined(__x86_64__) && defined(__GNUC__)
681681
uint32_t hi, lo;
682682
asm volatile("rdtsc" : "=a"(lo), "=d"(hi));

0 commit comments

Comments
 (0)