From 29280971beac11a8f6ccd9bdf947fcdf0260671a Mon Sep 17 00:00:00 2001 From: Soma Mizobuchi <34585795+somamizobuchi@users.noreply.github.com> Date: Sun, 15 Mar 2026 15:31:18 -0400 Subject: [PATCH] rcore_platform_sdl: Fix `GetTime()` resolution for sdl (#5653) `SDL_GetTicks()` only has millisecond resolution so switched to `SLD_GetPerformanceCounter()` combined with `SDL_GetPerformanceFrequency()` which should allow more granular timing Fix: remove intermediate variable Remove second cast --- src/platforms/rcore_desktop_sdl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c index 9dbd0b873..11c83c72c 100644 --- a/src/platforms/rcore_desktop_sdl.c +++ b/src/platforms/rcore_desktop_sdl.c @@ -1276,9 +1276,7 @@ void SwapScreenBuffer(void) // Get elapsed time measure in seconds double GetTime(void) { - unsigned int ms = SDL_GetTicks(); // Elapsed time in milliseconds since SDL_Init() - double time = (double)ms/1000; - return time; + return (double)SDL_GetPerformanceCounter() / SDL_GetPerformanceFrequency(); } // Open URL with default system browser (if available)