From 81489666a1d4303cfc8cd2c5d3396c08c0a5453f Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 20 Jun 2025 12:24:21 -0300 Subject: cli: move formatDuration here --- src/upd8.js | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'src/upd8.js') diff --git a/src/upd8.js b/src/upd8.js index 145a4f43..28c08238 100755 --- a/src/upd8.js +++ b/src/upd8.js @@ -42,7 +42,7 @@ import wrap from 'word-wrap'; import {mapAggregate, openAggregate, showAggregate} from '#aggregate'; import CacheableObject from '#cacheable-object'; -import {stringifyCache} from '#cli'; +import {formatDuration, stringifyCache} from '#cli'; import {displayCompositeCacheAnalysis} from '#composite'; import find, {bindFind, getAllFindSpecs} from '#find'; import {processLanguageFile, watchLanguageFile, internalDefaultStringsFile} @@ -3364,23 +3364,6 @@ if (true || isMain(import.meta.url) || path.basename(process.argv[1]) === 'hsmus })(); } -function formatDuration(timeDelta) { - const seconds = timeDelta / 1000; - - if (seconds > 90) { - const modSeconds = Math.floor(seconds % 60); - const minutes = Math.floor(seconds - seconds % 60) / 60; - return `${minutes}m${modSeconds}s`; - } - - if (seconds < 0.1) { - return 'instant'; - } - - const precision = (seconds > 1 ? 3 : 2); - return `${seconds.toPrecision(precision)}s`; -} - function showStepStatusSummary() { const longestNameLength = Math.max(... -- cgit 1.3.0-6-gf8a5