Single liverun type

This commit is contained in:
2026-02-07 00:55:23 +01:00
parent 9cf69fde7d
commit 75042007b7
6 changed files with 54 additions and 68 deletions
+15
View File
@@ -0,0 +1,15 @@
export default function formatTime(elapsedMs: number, formatMs = true) {
const totalSeconds = formatMs
? elapsedMs / 1000
: Math.floor(elapsedMs / 1000);
const hours = String(Math.floor(totalSeconds / 3600)).padStart(2, "0");
const minutes = String(Math.floor((totalSeconds % 3600) / 60)).padStart(
2,
"0",
);
const seconds = formatMs
? (totalSeconds % 60).toFixed(2).padStart(2, "0")
: (totalSeconds % 60).toString().padStart(2, "0");
return `${totalSeconds / 3600 >= 1 ? hours + ":" : ""}${minutes}:${seconds}`;
}