From 08cfbc7d6ce88d7dc9b7c0295cadfc2475fcfac3 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Tue, 28 May 2024 05:18:33 +0000 Subject: [PATCH] Simplify `sf::Clock` usage --- src/SFML/Window/Window.cpp | 3 +-- src/SFML/Window/iOS/EaglContext.mm | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/SFML/Window/Window.cpp b/src/SFML/Window/Window.cpp index 4b00bc106..5a39d2c44 100644 --- a/src/SFML/Window/Window.cpp +++ b/src/SFML/Window/Window.cpp @@ -187,8 +187,7 @@ void Window::display() // Limit the framerate if needed if (m_frameTimeLimit != Time::Zero) { - sleep(m_frameTimeLimit - m_clock.getElapsedTime()); - m_clock.restart(); + sleep(m_frameTimeLimit - m_clock.restart()); } } diff --git a/src/SFML/Window/iOS/EaglContext.mm b/src/SFML/Window/iOS/EaglContext.mm index 868af9f89..0837ae992 100644 --- a/src/SFML/Window/iOS/EaglContext.mm +++ b/src/SFML/Window/iOS/EaglContext.mm @@ -258,8 +258,7 @@ void EaglContext::display() if (m_vsyncEnabled) { constexpr Time frameDuration = seconds(1.f / 60.f); - sleep(frameDuration - m_clock.getElapsedTime()); - m_clock.restart(); + sleep(frameDuration - m_clock.restart()); } }