cmux/node_modules/time-span/index.js
2026-01-29 17:36:26 -08:00

14 lines
421 B
JavaScript

'use strict';
const convertHrtime = require('convert-hrtime');
module.exports = () => {
const start = process.hrtime();
const end = type => convertHrtime(process.hrtime(start))[type];
const returnValue = () => end('milliseconds');
returnValue.rounded = () => Math.round(end('milliseconds'));
returnValue.seconds = () => end('seconds');
returnValue.nanoseconds = () => end('nanoseconds');
return returnValue;
};