How to use convert-hrtime - 2 common examples

To help you get started, we’ve selected a few convert-hrtime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github postcss / postcss-devtools / src / index.js View on Github external
const updateSummary = (summary, {plugin, rawTime}, {precise}) => {
    const summaryForPlugin = summary[plugin] || {rawTime: [0, 0]};
    const newRawTime = hrtimeAdd(summaryForPlugin.rawTime, rawTime);
    const formatted = pretty(newRawTime, {precise});
    const text = 'Completed in ' + pretty(newRawTime, {precise});
    const time = convert(newRawTime);
    return {
        ...summary,
        [plugin]: {rawTime: newRawTime, formatted, text, time},
    };
};
github postcss / postcss-devtools / src / index.js View on Github external
function getMessage (plugin, completed, precise) {
    const formatted = pretty(completed, {precise});
    return {
        plugin,
        formatted,
        text: `Completed in ${formatted}`,
        time: convert(completed),
        rawTime: completed,
        _devtools: true,
    };
}

convert-hrtime

Convert the result of `process.hrtime.bigint()` to seconds, milliseconds, nanoseconds

MIT
Latest version published 4 years ago

Package Health Score

70 / 100
Full package analysis

Popular convert-hrtime functions