aboutsummaryrefslogtreecommitdiff
path: root/lib/cobalt.js
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
commitadc1a8da06f8af4c06a311ca459de4dcf379f5fd (patch)
tree39562f3cf44001b421b864f9a8c5093da1f0e298 /lib/cobalt.js
parente16e2dbf4c0911a5d5e8d1d56bb1c674b37fc161 (diff)
Proper nows now
Diffstat (limited to 'lib/cobalt.js')
-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) {