The timeOrigin read-only property of the Performance interface returns the high resolution timestamp that is used as the baseline for performance-related timestamps.

In Window contexts, this value represents the time when navigation has started. In Worker and ServiceWorker contexts, this value represents the time when the worker is run. You can use this property to synchronize the time origins between the contexts (see example below).

Note: The value of performance.timeOrigin may differ from the value returned by executed at the time origin, because may have been impacted by system and user clock adjustments, clock skew, etc. The timeOrigin property is a monotonic clock which current time never decreases and which isn't subject to these adjustments.


A high resolution timestamp.


Synchronizing time between contexts

To account for the different time origins in window and worker contexts, you can translate the timestamps coming from worker scripts with the help of the timeOrigin property, so the timings synchronize for the entire application.

In worker.js

self.addEventListener("connect", (event) => {
  const port = event.ports[0];

  port.onmessage = function (event) {
    const workerTaskStart =;
    // doSomeWork()
    const workerTaskEnd =;

  // Convert worker-relative timestamps to absolute timestamps, then send to the window
    startTime: workerTaskStart + performance.timeOrigin,
    endTime: workerTaskEnd + performance.timeOrigin,

In main.js

const worker = new SharedWorker("worker.js");
worker.port.addEventListener("message", (event) => {
  // Convert absolute timestamps into window-relative timestamps
  const workerTaskStart = - performance.timeOrigin;
  const workerTaskEnd = - performance.timeOrigin;

  console.log("Worker task start: ", workerTaskStart);
  console.log("Worker task end: ", workerTaskEnd);


High Resolution Time
# dom-performance-timeorigin

Browser compatibility

BCD tables only load in the browser