From 3f38738a08c727fa9725b67b2d3995b36d520b17 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Wed, 5 Jun 2024 00:11:37 -0600 Subject: [PATCH] Revert "Simplify `sf::Clock` usage" This reverts commit 08cfbc7d6ce88d7dc9b7c0295cadfc2475fcfac3. --- src/SFML/Window/Window.cpp | 3 ++- src/SFML/Window/iOS/EaglContext.mm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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(); } }