mirror of
https://github.com/raysan5/raylib.git
synced 2026-03-19 15:18:11 +00:00
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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user