diff --git a/src/SFML/Window/Window.cpp b/src/SFML/Window/Window.cpp index 5a39d2c44..4b00bc106 100644 --- a/src/SFML/Window/Window.cpp +++ b/src/SFML/Window/Window.cpp @@ -187,7 +187,8 @@ void Window::display() // Limit the framerate if needed if (m_frameTimeLimit != Time::Zero) { - sleep(m_frameTimeLimit - m_clock.restart()); + sleep(m_frameTimeLimit - m_clock.getElapsedTime()); + m_clock.restart(); } } diff --git a/src/SFML/Window/iOS/EaglContext.mm b/src/SFML/Window/iOS/EaglContext.mm index 0837ae992..868af9f89 100644 --- a/src/SFML/Window/iOS/EaglContext.mm +++ b/src/SFML/Window/iOS/EaglContext.mm @@ -258,7 +258,8 @@ void EaglContext::display() if (m_vsyncEnabled) { constexpr Time frameDuration = seconds(1.f / 60.f); - sleep(frameDuration - m_clock.restart()); + sleep(frameDuration - m_clock.getElapsedTime()); + m_clock.restart(); } }