Skip to content

Commit c06c107

Browse files
committed
added Date.now fallback to Common.now, closes #739
1 parent 9915007 commit c06c107

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/core/Common.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ module.exports = Common;
252252

253253
/**
254254
* Returns the current timestamp since the time origin (e.g. from page load).
255-
* The result will be high-resolution including decimal places if available.
255+
* The result is in milliseconds and will use high-resolution timing if available.
256256
* @method now
257-
* @return {number} the current timestamp
257+
* @return {number} the current timestamp in milliseconds
258258
*/
259259
Common.now = function() {
260260
if (typeof window !== 'undefined' && window.performance) {
@@ -265,6 +265,10 @@ module.exports = Common;
265265
}
266266
}
267267

268+
if (Date.now) {
269+
return Date.now();
270+
}
271+
268272
return (new Date()) - Common._nowStartTime;
269273
};
270274

0 commit comments

Comments
 (0)