From 225001b53b6897e9309e593cd220d74a0f9dd5cc Mon Sep 17 00:00:00 2001
From: Christmas-Missionary
<156368675+Christmas-Missionary@users.noreply.github.com>
Date: Sat, 2 May 2026 01:45:35 +0000
Subject: [PATCH] replaced mach_absolute_time()
- Addresses issue #15115
- mach_absolute_time can be misused for fingerprinting. This is bad.
- Apple docs prefer clock_gettime_nsec_np(CLOCK_UPTIME_RAW) in time.h
- Since HAVE_NANOSLEEP is defined, time.h is included
---
src/timer/unix/SDL_systimer.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/timer/unix/SDL_systimer.c b/src/timer/unix/SDL_systimer.c
index 8fc87c9ef8212..9a72d43685a9e 100644
--- a/src/timer/unix/SDL_systimer.c
+++ b/src/timer/unix/SDL_systimer.c
@@ -101,7 +101,8 @@ Uint64 SDL_GetPerformanceCounter(void)
ticks *= SDL_NS_PER_SECOND;
ticks += now.tv_nsec;
#elif defined(SDL_PLATFORM_APPLE)
- ticks = mach_absolute_time();
+ // With HAVE_NANOSLEEP defined, time.h is included
+ ticks = clock_gettime_nsec_np(CLOCK_UPTIME_RAW);
#else
SDL_assert(false);
ticks = 0;