Neale Pickett
·
2023-01-17
time.mjs
1/**
2 * A time duration.
3 *
4 * JavaScript uses milliseconds in most (but not all) places.
5 * I've found it helpful to be able to multiply by a unit, so it's clear what's going on.
6 *
7 * @typedef {number} Duration
8 */
9/** @type {Duration} */
10const Millisecond = 1
11/** @type {Duration} */
12const Second = 1000 * Millisecond
13/** @type {Duration} */
14const Minute = 60 * Second
15/** @type {Duration} */
16const Hour = 60 * Minute
17
18export {Millisecond, Second, Minute, Hour}