MCPcopy Create free account
hub / github.com/nodejs/node / toMs

Function toMs

lib/internal/vfs/providers/memory.js:91–96  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

89 * @returns {number} Milliseconds since epoch
90 */
91function 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
99const kRoot = Symbol('kRoot');

Callers 2

utimesSyncMethod · 0.85
lutimesSyncMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected