UNPKG

1.09 kBTypeScriptView Raw
1/**
2 * Defines High-Resolution Time.
3 *
4 * The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970.
5 * The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds.
6 * For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150.
7 * The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds:
8 * HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210.
9 * The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
10 * HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
11 * This is represented in HrTime format as [1609504210, 150000000].
12 */
13export declare type HrTime = [number, number];
14/**
15 * Defines TimeInput.
16 *
17 * hrtime, epoch milliseconds, performance.now() or Date
18 */
19export declare type TimeInput = HrTime | number | Date;
20//# sourceMappingURL=Time.d.ts.map
\No newline at end of file