The method returns a DOMHighResTimeStamp (en-US), measured in milliseconds.

경고: The timestamp is not actually high-resolution. To mitigate security threats such as Spectre, browsers currently round the results to varying degrees. (Firefox started rounding to 1 millisecond in Firefox 60.) Some browsers may also slightly randomize the timestamp. The precision may improve again in future releases; browser developers are still investigating these timing attacks and how best to mitigate them.

참고: 이 기능은 Web Worker에서 사용할 수 있습니다

The returned value represents the time elapsed since the time origin (en-US).

Bear in mind the following points:

  • 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.


t =;


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

Unlike other timing data available to JavaScript (for example (en-US)), 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). Otherwise, performance.timing.navigationStart + will be approximately equal to

Reduced time precision

To offer protection against timing attacks and fingerprinting, the precision of might get rounded depending on browser settings. In Firefox, the privacy.reduceTimerPrecision preference is enabled by default and defaults to 1ms.

// reduced time precision (1ms) in Firefox 60;
// 8781416
// 8781815
// 8782206
// ...

// reduced time precision with `privacy.resistFingerprinting` enabled;
// 8865400
// 8866200
// 8866700
// ...

In Firefox, you can also enable privacy.resistFingerprinting — this changes the precision to 100ms or the value of privacy.resistFingerprinting.reduceTimerPrecision.microseconds, whichever is larger.


High Resolution Time
# dom-performance-now

브라우저 호환성

BCD tables only load in the browser

See also