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

  • In any context, the value is the value from t0 of the main context (the PerformanceTiming.navigationStart property) — main context, or any type of worker spawned from the main context (or another worker.)
  • In dedicated workers created from a Window context, the value in the worker will be lower than in the window who spawned that worker. It used to be the same as t0 of the main context, but this was changed.
  • In shared or service workers, the value in the worker might be higher than that of the main context because that window can be created after those workers.
var t0 =;
var t1 =;
console.log('Call to doSomething took ' + (t1 - t0) + ' milliseconds.')