The method returns a DOMHighResTimeStamp, measured in milliseconds, accurate to one thousandth of a millisecond.

The value represented by 0 varies according the context:

  • in shared or service workers, the epoch represents the moment the worker started.
  • outside workers, or in dedicated workers created from a Window context, the epoch is the value of the PerformanceTiming.navigationStart property.
  • in dedicated workers created from another worker, the epoch is set to the one of this other worker.


t =;


var t0 =;
var t1 =;
console.log("Call to doSomething took " + (t1 - t0) + " milliseconds.")

Unlike other timing data available to JavaScript (for example, the timestamps returned by are not limited to one-millisecond resolution. Instead, they represent times as floating-point numbers with up to microsecond precision.

Also unlike, the values returned by always increase at a constant rate, independent of the system clock (which might be adjusted manually or skewed by software like NTP).


Specification Status Comment
High Resolution Time
The definition of '' in that specification.
Recommendation Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 20.0 webkit
24.0 [1]
15.0 (15.0) 10.0 15.0 8.0
on Web workers 33 34.0 (34.0) ? ? ?
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 4.0 25.0 15.0 (15.0) 10.0 Not supported Not supported
on Web workers ? ? 34.0 (34.0) ? ? ?

[1] Windows version of Chrome 20 through 33, at the time of this writing, returns only to millisecond precision.

See also

Document Tags and Contributors

Last updated by: Sebastianz,