Closed frangio closed 7 years ago
Thanks @frangio. Yes, you're right.
While Date.now
has been "monotonic enough" in practice, any change to the system clock while an app is running would likely cause some chaos. I think we could make a change like this for 2.0 (work is ongoing here in @most/core
)). Coincidentally, we've already been discussing switching to relative time rather than absolute system clock time, so switching to a truly monotonic time source would fit well with that.
I'm not sure if most supports platforms other than the browser
Yep, it does. It supports Node and browsers.
@frangio We're tracking this in https://github.com/mostjs/core/issues/62 now. Closing this one. Thanks again!
Great!
The default timer uses
Date.now
to get a timestamp, which is not monotonic like the Architecture document says it should be.In the browser there's a
performance.now
method that is more precise and, as far as I can tell, guaranteed to be monotonic.It's not available in Node.js. I'm not sure if most supports platforms other than the browser, but in that case the performance-now package on npm provides a cross-platform solution falling back to a native monotonic Node.js function or even
Date.now
if nothing else is available.