MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / formatElapsedTime

Function formatElapsedTime

cli/src/utils/format-elapsed-time.ts:19–33  ·  view source on GitHub ↗
(elapsedSeconds: number)

Source from the content-addressed store, hash-verified

17 * - 3600+ seconds (1+ hours): "Xh" or "Xh Ym" (e.g., "1h", "2h 15m")
18 */
19export const formatElapsedTime = (elapsedSeconds: number): string => {
20 if (elapsedSeconds < 60) {
21 return `${elapsedSeconds}s`
22 }
23
24 const hours = Math.floor(elapsedSeconds / 3600)
25 const minutes = Math.floor((elapsedSeconds % 3600) / 60)
26 const seconds = elapsedSeconds % 60
27
28 if (hours > 0) {
29 return `${hours}h` + (minutes > 0 ? ` ${minutes}m` : '')
30 }
31
32 return `${minutes}m` + (seconds > 0 ? ` ${seconds}s` : '')
33}

Callers 4

renderElapsedTimeFunction · 0.90
ElapsedTimerFunction · 0.90
handleRunCompletionFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected