@@ -48,20 +48,6 @@ const callbackList: {
4848// var debuglog = logger.log.bind(logger);
4949const debuglog = function ( ...params : any [ ] ) { } ;
5050
51- /**
52- * Replace the function used by this module to get the current time.
53- *
54- * Intended for use by the unit tests.
55- *
56- * @param {function } [f] function which should return a millisecond counter
57- *
58- * @internal
59- */
60- export function setNow ( f : ( ) => number ) : void {
61- now = f || Date . now ;
62- }
63- let now = Date . now ;
64-
6551/**
6652 * reimplementation of window.setTimeout, which will call the callback if
6753 * the wallclock time goes past the deadline.
@@ -78,7 +64,7 @@ export function setTimeout(func: (...params: any[]) => void, delayMs: number, ..
7864 delayMs = 0 ;
7965 }
8066
81- const runAt = now ( ) + delayMs ;
67+ const runAt = Date . now ( ) + delayMs ;
8268 const key = count ++ ;
8369 debuglog ( "setTimeout: scheduling cb" , key , "at" , runAt ,
8470 "(delay" , delayMs , ")" ) ;
@@ -141,7 +127,7 @@ function scheduleRealCallback(): void {
141127 return ;
142128 }
143129
144- const timestamp = now ( ) ;
130+ const timestamp = Date . now ( ) ;
145131 const delayMs = Math . min ( first . runAt - timestamp , TIMER_CHECK_PERIOD_MS ) ;
146132
147133 debuglog ( "scheduleRealCallback: now:" , timestamp , "delay:" , delayMs ) ;
@@ -150,7 +136,7 @@ function scheduleRealCallback(): void {
150136
151137function runCallbacks ( ) : void {
152138 let cb ;
153- const timestamp = now ( ) ;
139+ const timestamp = Date . now ( ) ;
154140 debuglog ( "runCallbacks: now:" , timestamp ) ;
155141
156142 // get the list of things to call
0 commit comments