From cda89ebb58767271f7194fcfa6855ac6b7442ec7 Mon Sep 17 00:00:00 2001 From: flashback-fx Date: Sun, 5 Jun 2022 11:14:26 +0200 Subject: [PATCH] Fix regression that was causing video stuttering (#2503) --- src/rcore.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/rcore.c b/src/rcore.c index dbcf670bb..85954e606 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -4834,6 +4834,7 @@ void WaitTime(float ms) while ((currentTime - previousTime) < ms/1000.0f) currentTime = GetTime(); #else #if defined(SUPPORT_PARTIALBUSY_WAIT_LOOP) + double destTime = GetTime() + ms/1000.0f; double busyWait = ms*0.05; // NOTE: We are using a busy wait of 5% of the time ms -= (float)busyWait; #endif @@ -4857,11 +4858,7 @@ void WaitTime(float ms) #endif #if defined(SUPPORT_PARTIALBUSY_WAIT_LOOP) - double previousTime = GetTime(); - double currentTime = 0.0; - - // Partial busy wait loop (only a fraction of the total wait time) - while ((currentTime - previousTime) < (busyWait/1000.0f)) currentTime = GetTime(); + while (GetTime() < destTime) { } #endif #endif }