History

check for time machine

Andrew Meadows committed 10 years ago

Commit 5ac06401 parent 830d08c2 files · +13 −4Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 2 files). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+7−4
@@ -673,11 +673,14 @@ void ScriptEngine::run() { · 672 unmodified lines
673673 }
674674
675675 qint64 now = usecTimestampNow();
676− float deltaTime = (float) (now - lastUpdate) / (float) USECS_PER_SECOND;
677676
678− if (!_isFinished) {
679− if (_wantSignals) {
680− emit update(deltaTime);
677+ // we check for 'now' in the past in case people set their clock back
678+ if (lastUpdate < now) {
679+ float deltaTime = (float) (now - lastUpdate) / (float) USECS_PER_SECOND;
680+ if (!_isFinished) {
681+ if (_wantSignals) {
682+ emit update(deltaTime);
683+ }
681684 }
682685 }
683686 lastUpdate = now;