diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-06-20 12:24:21 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-06-20 12:24:21 -0300 |
commit | 81489666a1d4303cfc8cd2c5d3396c08c0a5453f (patch) | |
tree | 92388a723dc41c0761b9ef17f2577db789c72e5f /src/upd8.js | |
parent | a893eb7c0a9077705e4f882c3ea72a08dfbe2fce (diff) |
cli: move formatDuration here
Diffstat (limited to 'src/upd8.js')
-rwxr-xr-x | src/upd8.js | 19 |
1 files changed, 1 insertions, 18 deletions
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(... |