MCPcopy Create free account
hub / github.com/astercloud/aster / formatDuration

Function formatDuration

studio/src/lib/utils.ts:35–45  ·  view source on GitHub ↗
(ms: number)

Source from the content-addressed store, hash-verified

33
34// Format duration in milliseconds
35export function formatDuration(ms: number): string {
36 if (ms < 1000) {
37 return `${ms}ms`;
38 }
39 if (ms < 60000) {
40 return `${(ms / 1000).toFixed(1)}s`;
41 }
42 const minutes = Math.floor(ms / 60000);
43 const seconds = ((ms % 60000) / 1000).toFixed(0);
44 return `${minutes}m ${seconds}s`;
45}
46
47// Format percentage
48export function formatPercent(value: number, decimals: number = 1): string {

Callers 5

MetricsFunction · 0.90
TracesFunction · 0.90
OverviewFunction · 0.90
TraceDetailFunction · 0.90
TraceTimelineFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected