Constructor
new MonotonicClock(startTimeopt)
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
startTime |
number |
<optional> |
<time elapsed since the reference point, i.e. the time when the module was loaded>
|
the clock's start time (in ms) |
Members
(protected, static) _referenceTime :number
- Source:
The clock's referenceTime is the time when the module was loaded (in seconds).
Type:
- number
Methods
(static) getDate(locales, options) → {string}
- Source:
Get the current timestamp with language-sensitive formatting rules applied.
Note: This is just a convenience wrapper around `Intl.DateTimeFormat()`.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
locales |
string | array.string |
en-CA
|
A string with a BCP 47 language tag, or an array of such strings. |
options |
object | An object with detailed date and time styling information. |
Returns:
The current timestamp in the chosen format.
- Type
- string
(static) getDateStr() → {string}
- Source:
Get the clock's current time in the default format filtering out file name unsafe characters.
Note: This is mostly used as an appendix to the name of the keys save to the server.
Returns:
A string representing the current time formatted as YYYY-MM-DD_HH[h]mm.ss.sss
- Type
- string
(static) getReferenceTime() → {number}
- Source:
Get the time elapsed since the reference point.
Returns:
the time elapsed since the reference point (in seconds)
- Type
- number
getLastResetTime() → {number}
- Source:
Get the current offset being applied to the high resolution timebase used by this Clock.
Returns:
the offset (in seconds)
- Type
- number
getTime() → {number}
- Source:
Get the current time on this clock.
Returns:
the current time (in seconds)
- Type
- number