Skip to content
Myr

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 file

Take it

Add `result|error.durationMs` (#896)ehmickybefore adoption7088091

lines 1–2why, one step back
1import {hrtime} from 'node:process';
2

Add more code comments (#984)ehmickybefore adoptionfdd8a9f

line 3why, one step back
3// Start counting time before spawning the subprocess

Add `result|error.durationMs` (#896)ehmickybefore adoption7088091

lines 4–5why, one step back
4export const getStartTime = () => hrtime.bigint();
5

Add more code comments (#984)ehmickybefore adoptionfdd8a9f

lines 6–7why, one step back
6// Compute duration after the subprocess ended.
7// Printed by the `verbose` option.

Add `result|error.durationMs` (#896)ehmickybefore adoption7088091

line 8why, one step back
8export const getDurationMs = startTime => Number(hrtime.bigint() - startTime) / 1e6;