@@ -44,17 +44,12 @@ MockFirebase.ServerValue = {
4444 }
4545} ;
4646
47- var getServerTime , defaultClock ;
48- getServerTime = defaultClock = function ( ) {
49- return new Date ( ) . getTime ( ) ;
50- } ;
51-
5247MockFirebase . setClock = function ( fn ) {
53- getServerTime = fn ;
48+ utils . setServerClock ( fn ) ;
5449} ;
5550
5651MockFirebase . restoreClock = function ( ) {
57- getServerTime = defaultClock ;
52+ utils . restoreServerClock ( ) ;
5853} ;
5954
6055MockFirebase . autoId = function ( ) {
@@ -449,7 +444,7 @@ MockFirebase.prototype._dataChanged = function (unparsedData) {
449444 var data = utils . cleanData ( unparsedData ) ;
450445
451446 if ( utils . isServerTimestamp ( data ) ) {
452- data = getServerTime ( ) ;
447+ data = utils . getServerTime ( ) ;
453448 }
454449
455450 if ( pri !== this . priority ) {
@@ -475,7 +470,7 @@ MockFirebase.prototype._dataChanged = function (unparsedData) {
475470 keysToChange . forEach ( function ( key ) {
476471 var childData = unparsedData [ key ] ;
477472 if ( utils . isServerTimestamp ( childData ) ) {
478- childData = getServerTime ( ) ;
473+ childData = utils . getServerTime ( ) ;
479474 }
480475 self . _updateOrAdd ( key , childData , events ) ;
481476 } ) ;
@@ -493,7 +488,7 @@ MockFirebase.prototype._dataChanged = function (unparsedData) {
493488
494489MockFirebase . prototype . _priChanged = function ( newPriority ) {
495490 if ( utils . isServerTimestamp ( newPriority ) ) {
496- newPriority = getServerTime ( ) ;
491+ newPriority = utils . getServerTime ( ) ;
497492 }
498493 this . priority = newPriority ;
499494 if ( this . parent ) {
0 commit comments