MCPcopy Create free account
hub / github.com/Tong89/smartNode / formatTime

Function formatTime

frontend/src/utils/format.ts:39–45  ·  view source on GitHub ↗
(totalSeconds: number)

Source from the content-addressed store, hash-verified

37 * @param totalSeconds - Elapsed time in seconds (may be fractional; truncated).
38 */
39export function formatTime(totalSeconds: number): string {
40 const total = Math.max(0, Math.floor(isFinite(totalSeconds) ? totalSeconds : 0));
41 const hours = Math.floor(total / 3600);
42 const minutes = Math.floor((total % 3600) / 60);
43 const secs = total % 60;
44 return [hours, minutes, secs].map((p) => String(p).padStart(2, '0')).join(':');
45}
46
47/**
48 * Format a transmission progress value (0–100) as a percentage string like "42%".

Callers 1

format.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected