aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Beltran <ben@freshout.us>2013-05-13 11:09:25 -0500
committerBen Beltran <ben@freshout.us>2013-05-13 11:09:25 -0500
commitdaf011e64210fee392a909eb26c4d551faccb172 (patch)
treeac8ab10b835003f3da6c1d8281e6a8b617f3f6a6 /lib
parent963cb46b688216154f1299c233832258be5f5bbd (diff)
Proper nows now
Diffstat (limited to 'lib')
-rw-r--r--lib/cobalt.js10
1 files changed, 9 insertions, 1 deletions
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) {