MCPcopy Create free account
hub / github.com/bytebase/bytebase / formatDuration

Function formatDuration

frontend/src/react/components/task-run-log/model.ts:77–84  ·  view source on GitHub ↗
(ms: number)

Source from the content-addressed store, hash-verified

75};
76
77export const formatDuration = (ms: number): string => {
78 if (ms < 1) return "<1ms";
79 if (ms < 1000) return `${ms.toFixed(0)}ms`;
80 if (ms < 60000) return `${(ms / 1000).toFixed(1)}s`;
81 const minutes = Math.floor(ms / 60000);
82 const seconds = ((ms % 60000) / 1000).toFixed(0);
83 return `${minutes}m ${seconds}s`;
84};
85
86export const formatRelativeTime = (ms: number): string => {
87 if (ms < 1000) return `+${ms.toFixed(0)}ms`;

Callers 3

useTaskRunLogSectionsFunction · 0.90
getCommandDurationFunction · 0.70
buildSectionsFromEntriesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected