diff --git a/src/modules/timer/sdl/Timer.cpp b/src/modules/timer/sdl/Timer.cpp index fb8496718..3bd96c8a6 100644 --- a/src/modules/timer/sdl/Timer.cpp +++ b/src/modules/timer/sdl/Timer.cpp @@ -70,10 +70,11 @@ namespace sdl // Convert to number of seconds dt = (currTime - prevTime)/1000.0; + int timeSinceLast = (currTime - prevFpsUpdate)/1000.0; // Update FPS? - if ((currTime - prevFpsUpdate)/1000.0 > fpsUpdateFrequency) + if (timeSinceLast > fpsUpdateFrequency) { - fps = frames/fpsUpdateFrequency; + fps = frames/timeSinceLast; prevFpsUpdate = currTime; frames = 0; }