Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 2 files). Show all
Unified · Split
| @@ -673,11 +673,14 @@ void ScriptEngine::run() { · 672 unmodified lines | ||
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | qint64 now = usecTimestampNow(); |
| 676 | − float deltaTime = (float) (now - lastUpdate) / (float) USECS_PER_SECOND; | |
| 677 | 676 | |
| 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 | + } | |
| 681 | 684 | } |
| 682 | 685 | } |
| 683 | 686 | lastUpdate = now; |