diff --git a/src/java/com/threerings/media/FrameManager.java b/src/java/com/threerings/media/FrameManager.java index 214b7b6e4..86d0bdeb6 100644 --- a/src/java/com/threerings/media/FrameManager.java +++ b/src/java/com/threerings/media/FrameManager.java @@ -1,5 +1,5 @@ // -// $Id: FrameManager.java,v 1.43 2003/05/19 03:01:13 mdb Exp $ +// $Id: FrameManager.java,v 1.44 2003/07/29 00:41:40 mdb Exp $ package com.threerings.media; @@ -696,6 +696,16 @@ public abstract class FrameManager if (start > 0L) { getPerfMetrics()[0].record((int)(woke-start)); } + + // work around sketchy bug on WinXP that causes the clock + // to leap into the past from time to time + if (woke < _lastAttempt) { + Log.warning("Zoiks! We've leapt into the past, coping " + + "as best we can [dt=" + + (woke - _lastAttempt) + "]."); + _lastAttempt = woke; + } + if (woke - _lastAttempt >= _millisPerFrame) { _lastAttempt = woke; if (testAndSet()) { diff --git a/src/java/com/threerings/media/timer/SystemMediaTimer.java b/src/java/com/threerings/media/timer/SystemMediaTimer.java index 5f05cd068..2055174b5 100644 --- a/src/java/com/threerings/media/timer/SystemMediaTimer.java +++ b/src/java/com/threerings/media/timer/SystemMediaTimer.java @@ -1,5 +1,5 @@ // -// $Id: SystemMediaTimer.java,v 1.2 2003/07/29 00:27:32 mdb Exp $ +// $Id: SystemMediaTimer.java,v 1.3 2003/07/29 00:41:40 mdb Exp $ package com.threerings.media.timer; @@ -25,23 +25,7 @@ public class SystemMediaTimer implements MediaTimer // documentation inherited from interface public long getElapsedMillis () { - long stamp = System.currentTimeMillis() - _resetStamp; - - // on WinXP the time sometimes seems to leap into the - // past; here we do our best to work around this insanity - if (stamp < _lastStamp) { - // only warn once per time anomaly - if (stamp > _lastWarning) { - Log.warning("Someone call Einstein! The clock is " + - "running backwards [dt=" + - (stamp - _lastStamp) + "]."); - _lastWarning = _lastStamp; - } - stamp = _lastStamp; - } - _lastStamp = stamp; - - return stamp; + return System.currentTimeMillis() - _resetStamp; } // documentation inherited from interface @@ -52,7 +36,4 @@ public class SystemMediaTimer implements MediaTimer /** The time at which this timer was last reset. */ protected long _resetStamp = System.currentTimeMillis(); - - /** Used to ensure that the timer is sane. */ - protected long _lastStamp, _lastWarning; }