Let's remember our previous lessons and attempt to use the less-vulnerable version of getting the time.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@976 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Mike Thomas
2010-08-11 18:46:33 +00:00
parent 98619ae443
commit 407af70322
+6 -3
View File
@@ -17,8 +17,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.miso.client { package com.threerings.miso.client {
import flash.utils.getTimer;
import flash.events.TimerEvent; import flash.events.TimerEvent;
import flash.utils.Timer; import flash.utils.Timer;
@@ -31,6 +29,7 @@ public class Ticker
public function start () :void public function start () :void
{ {
_t.addEventListener(TimerEvent.TIMER, handleTimer); _t.addEventListener(TimerEvent.TIMER, handleTimer);
_start = new Date().time;
_t.start(); _t.start();
} }
@@ -43,7 +42,7 @@ public class Ticker
public function handleTimer (event :TimerEvent) :void public function handleTimer (event :TimerEvent) :void
{ {
tick(getTimer()); tick(int(new Date().time - _start));
} }
protected function tick (tickStamp :int) :void protected function tick (tickStamp :int) :void
@@ -63,9 +62,13 @@ public class Ticker
_tickables.remove(tickable); _tickables.remove(tickable);
} }
/** Everyone who wants to hear about our ticks. */
protected var _tickables :Array = []; protected var _tickables :Array = [];
/** A timer that will fire every "frame". */ /** A timer that will fire every "frame". */
protected var _t :Timer = new Timer(1); protected var _t :Timer = new Timer(1);
/** What time our ticker started running - tickStamps will be relative to this time. */
protected var _start :Number;
} }
} }