DOMHighResTimeStamp

The DOMHighResTimeStamp type is a double and is used to store a time value. The value could be a discrete point in time or the difference in time between two discrete points in time. The unit is milliseconds and should be accurate to 5 µs (microseconds). However, if the browser is unable to provide a time value accurate to 5 microseconds (due, for example, to hardware or software constraints), the browser can represent the value as a time in milliseconds accurate to a millisecond.

If the device or operating system the user agent is running on doesn't have a clock accurate to the microsecond level, they may only be accurate to the millisecond.

Properties

This type has no properties. It is a double-precision floating-point value.

Value

The value of a DOMHighResTimeStamp is a double-precision floating-point number which describes the number of milliseconds (accurate to within 5 microseconds if the device supports it) elapsed between two points in time. The starting time can be either a specific time determined by the script for a site or app, or the time origin.

The time origin

The time origin is a standard time which is considered to be the beginning of the current document's lifetime. It's calculated like his:

  • If the script's global object is a Window, the time origin is determined as follows:
    • If the current Document is the first one loaded in the Window, the time origin is the time at which the browser context was created.
    • If during the process of unloading the previous document which was loaded in the window, a confirmation dialog was displayed to let the user confirm whether or not to leave the previous page, the time origin is the time at which the user confirmed that navigating to the new page was acceptable.
    • If neither of the above determines the time origin, then the time origin is the time at which the navigation responsible for creating the window's current Document took place.
  • If the script's global object is a WorkerGlobalScope (that is, the script is running as a web worker), the time origin is the moment at which the worker was created.
  • In all other cases, the time origin is undefined.

Methods

This type has no methods.

Specifications

Specification Status Comment
High Resolution Time Level 2
The definition of 'DOMHighResTimeStamp' in that specification.
Candidate Recommendation Stricter definitions of interfaces and types.
High Resolution Time
The definition of 'DOMHighResTimeStamp' in that specification.
Recommendation Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 6 7.0 (7.0) 9 15.0 8
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support (Yes) 15.0 (15.0) 9 15.0 9

See also

Document Tags and Contributors

 Last updated by: ryanve,