From 295d83178d5567743c720e7405ac974b0bcab832 Mon Sep 17 00:00:00 2001 From: dmaclach Date: Tue, 23 Jan 2024 14:53:20 -0800 Subject: [PATCH] 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 #15029 --- src/google/protobuf/map.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index 4ea42241dd..e28c1c6ea2 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -25,7 +25,7 @@ #include #if !defined(GOOGLE_PROTOBUF_NO_RDTSC) && defined(__APPLE__) -#include +#include #endif #include "google/protobuf/stubs/common.h" @@ -676,7 +676,7 @@ class PROTOBUF_EXPORT UntypedMapBase { #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));