diff --git a/src/Nazara/Core/ApplicationBase.cpp b/src/Nazara/Core/ApplicationBase.cpp index 60dd50b4f..e2522450b 100644 --- a/src/Nazara/Core/ApplicationBase.cpp +++ b/src/Nazara/Core/ApplicationBase.cpp @@ -78,6 +78,7 @@ namespace Nz else updaterEntry.nextUpdate = updaterEntry.lastUpdate + (-interval); + updaterEntry.lastUpdate = m_currentTime; updaterEntry.nextUpdate = std::max(updaterEntry.nextUpdate, m_currentTime); } diff --git a/tests/UnitTests/Engine/Core/ApplicationTest.cpp b/tests/UnitTests/Engine/Core/ApplicationTest.cpp index 08c552f7a..1650e3701 100644 --- a/tests/UnitTests/Engine/Core/ApplicationTest.cpp +++ b/tests/UnitTests/Engine/Core/ApplicationTest.cpp @@ -39,6 +39,8 @@ SCENARIO("Application", "[CORE][ABSTRACTHASH]") INFO("First update should have elapsed time as zero"); CHECK(elapsedTime == Nz::Time::Zero()); } + else + CHECK(elapsedTime < Nz::Time::Milliseconds(200)); triggerCount++; }); @@ -51,6 +53,10 @@ SCENARIO("Application", "[CORE][ABSTRACTHASH]") CHECK(triggerCount == 2); app.Update(Nz::Time::Milliseconds(90)); CHECK(triggerCount == 2); // this does not trigger since 100ms have not elapsed since last update + app.Update(Nz::Time::Milliseconds(10)); + CHECK(triggerCount == 3); + app.Update(Nz::Time::Milliseconds(100)); + CHECK(triggerCount == 4); } WHEN("Using fixed-time interval")