* Converts a time argument (Date, number, or string) to milliseconds. * Numbers are treated as seconds (matching Node.js utimes convention). * @param {Date|number|string} time The time value * @returns {number} Milliseconds since epoch
(time)
| 89 | * @returns {number} Milliseconds since epoch |
| 90 | */ |
| 91 | function toMs(time) { |
| 92 | if (typeof time === 'number') return time * 1000; |
| 93 | if (typeof time === 'string') return DateNow(); // Fallback for string timestamps |
| 94 | if (typeof time === 'object' && time !== null) return +time; |
| 95 | return time; |
| 96 | } |
| 97 | |
| 98 | // Private symbols |
| 99 | const kRoot = Symbol('kRoot'); |
no outgoing calls
no test coverage detected