We really need to adjust _priorCurrent regardless of whether this particular call to elapsed() is at a driftRatio of 1.0 or not - the next one might not be, so we need to keep it up to date. Otherwise, we could potentially yank _startStamp around by minutes or hours due to a stale _priorCurrent.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@726 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -107,8 +107,9 @@ public abstract class CalibratingTimer
|
|||||||
if (_driftRatio != 1.0) {
|
if (_driftRatio != 1.0) {
|
||||||
long elapsed = current - _priorCurrent;
|
long elapsed = current - _priorCurrent;
|
||||||
_startStamp += (elapsed - (elapsed * _driftRatio));
|
_startStamp += (elapsed - (elapsed * _driftRatio));
|
||||||
_priorCurrent = current;
|
|
||||||
}
|
}
|
||||||
|
_priorCurrent = current;
|
||||||
|
|
||||||
return current - _startStamp;
|
return current - _startStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user