What’s the best way to get monotonically increasing time in JavaScript? I’m hoping for something like Java’s System.nanoTime().
System.nanoTime()
Date() obvi
Date()
Firefox provides "delay" argument for setTimeout... this is the one of ways to implement monotonically increased time counter.
var time = 0; setTimeout(function x(actualLateness) { setTimeout(x, 0); time += actualLateness; }, 0);