check for time machine

This commit is contained in:
Andrew Meadows 2016-03-27 16:33:53 -07:00
parent 830d08c385
commit 5ac0640cbe
2 changed files with 13 additions and 4 deletions

View file

@ -561,6 +561,12 @@ bool ParticleEffectEntityItem::needsToCallUpdate() const {
void ParticleEffectEntityItem::update(const quint64& now) {
// we check for 'now' in the past in case users set their clock backward
if (now < _lastSimulated) {
_lastSimulated = now;
return;
}
float deltaTime = (float)(now - _lastSimulated) / (float)USECS_PER_SECOND;
_lastSimulated = now;

View file

@ -673,11 +673,14 @@ void ScriptEngine::run() {
}
qint64 now = usecTimestampNow();
float deltaTime = (float) (now - lastUpdate) / (float) USECS_PER_SECOND;
if (!_isFinished) {
if (_wantSignals) {
emit update(deltaTime);
// we check for 'now' in the past in case people set their clock back
if (lastUpdate < now) {
float deltaTime = (float) (now - lastUpdate) / (float) USECS_PER_SECOND;
if (!_isFinished) {
if (_wantSignals) {
emit update(deltaTime);
}
}
}
lastUpdate = now;