MCPcopy Index your code
hub / github.com/ByBrawe/opencode-loop / durationToText

Function durationToText

src/index.js:85–93  ·  view source on GitHub ↗
(ms)

Source from the content-addressed store, hash-verified

83 if (unit === "ms") return amount
84 if (unit.startsWith("s")) return amount * 1000
85 if (unit.startsWith("m")) return amount * 60_000
86 if (unit.startsWith("h")) return amount * 3_600_000
87 if (unit.startsWith("d")) return amount * 86_400_000
88 return null
89}
90
91function durationToText(ms) {
92 if (ms === 0) return "every idle"
93 if (!Number.isFinite(ms)) return "unknown"
94 if (ms % 86_400_000 === 0) return `${ms / 86_400_000}d`
95 if (ms % 3_600_000 === 0) return `${ms / 3_600_000}h`
96 if (ms % 60_000 === 0) return `${ms / 60_000}m`

Callers 2

jobLabelFunction · 0.85
statusLoopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected