REVIEWED: GetTime(), make sure division is with doubles #5668

This commit is contained in:
Ray
2026-03-17 19:38:29 +01:00
parent 48a34d63ed
commit 0de2e8092b

View File

@@ -1276,7 +1276,7 @@ void SwapScreenBuffer(void)
// Get elapsed time measure in seconds
double GetTime(void)
{
double time = (double)(SDL_GetPerformanceCounter()/SDL_GetPerformanceFrequency()) - CORE.Time.base;
double time = ((double)SDL_GetPerformanceCounter()/(double)SDL_GetPerformanceFrequency()) - CORE.Time.base;
return time;
}
@@ -2125,7 +2125,7 @@ int InitPlatform(void)
// Initialize timing system
//----------------------------------------------------------------------------
// Get base time from window initialization
CORE.Time.base = (double)(SDL_GetPerformanceCounter()/SDL_GetPerformanceFrequency());
CORE.Time.base = (double)SDL_GetPerformanceCounter()/(double)SDL_GetPerformanceFrequency();
#if defined(_WIN32) && SUPPORT_WINMM_HIGHRES_TIMER && !SUPPORT_BUSY_WAIT_LOOP
SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "1"); // SDL equivalent of timeBeginPeriod() and timeEndPeriod()