duration.js
This file
Path
lib/return/duration.js
8 lines · 313 bytes · JavaScript
Last changed by
Add more code comments (#984)ehmickybefore adoptionfdd8a9f
History of this fileTake it
Add `result|error.durationMs` (#896)ehmickybefore adoption7088091
lines 1–2why, one step back1import {hrtime} from 'node:process';2Add more code comments (#984)ehmickybefore adoptionfdd8a9f
line 3why, one step back3// Start counting time before spawning the subprocessAdd `result|error.durationMs` (#896)ehmickybefore adoption7088091
lines 4–5why, one step back4export const getStartTime = () => hrtime.bigint();5Add more code comments (#984)ehmickybefore adoptionfdd8a9f
lines 6–7why, one step back6// Compute duration after the subprocess ended.7// Printed by the `verbose` option.Add `result|error.durationMs` (#896)ehmickybefore adoption7088091
line 8why, one step back8export const getDurationMs = startTime => Number(hrtime.bigint() - startTime) / 1e6;