From adc1a8da06f8af4c06a311ca459de4dcf379f5fd Mon Sep 17 00:00:00 2001 From: Ben Beltran Date: Mon, 13 May 2013 11:09:25 -0500 Subject: Proper nows now --- lib/cobalt.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/cobalt.js b/lib/cobalt.js index 58a305c..17e6948 100644 --- a/lib/cobalt.js +++ b/lib/cobalt.js @@ -239,7 +239,15 @@ // Returns the current time in microseconds. now : function () { - this.constructor.now(); + if (typeof performance !== 'undefined' && performance.timing) { + return performance.timing.navigationStart + performance.now(); + } + + if (typeof Microtime !== 'undefined') { + return Microtime.nowDouble() * 1000; + } + + return Date.now(); }, _levelString : function (level) { -- cgit