ITimeProvider interface

This is a ServiceScope contract for reading the system clock.

Remarks

This interface abstracts the functionality of the system time APIs for usage with a ServiceScope. For example, a unit test might replace the default TimeProvider service with a mock implementation that follows a manually incremented timeline, in order to ensure that test failures are always repeatable.

Methods

getDate()

Returns the current date/time, similar to the Date class constructor.

getTimestamp()

Returns a DOMHighResTimeStamp timing measurement, as defined by the standard performance.now() API.

Method Details

getDate()

Returns the current date/time, similar to the Date class constructor.

getDate(): Date;

Returns

Date

getTimestamp()

Returns a DOMHighResTimeStamp timing measurement, as defined by the standard performance.now() API.

getTimestamp(): number;

Returns

number