diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index a5614f9d..3460c7c9 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1721,11 +1721,15 @@ if (typeof window == void 0 && typeof exports == "object") { } getJasmineRequireObj().Timer = function() { + var defaultNow = (function(Date) { + return function() { return new Date().getTime(); }; + })(Date); + function Timer(options) { options = options || {}; - var now = options.now || function() { return new Date().getTime(); }, - startTime; + var now = options.now || defaultNow, + startTime; this.start = function() { startTime = now(); diff --git a/src/core/Timer.js b/src/core/Timer.js index 92cc97b1..f8270f41 100644 --- a/src/core/Timer.js +++ b/src/core/Timer.js @@ -1,9 +1,13 @@ getJasmineRequireObj().Timer = function() { + var defaultNow = (function(Date) { + return function() { return new Date().getTime(); }; + })(Date); + function Timer(options) { options = options || {}; - var now = options.now || function() { return new Date().getTime(); }, - startTime; + var now = options.now || defaultNow, + startTime; this.start = function() { startTime = now();