[chore] used codex to create a base layout for src

This commit is contained in:
2026-02-26 17:55:52 +01:00
parent 74c9ded46b
commit f804d55ce2
12 changed files with 416 additions and 135 deletions

17
src/shared/time/format.ts Normal file
View File

@@ -0,0 +1,17 @@
type DurationLike = {
secs?: number;
nanos?: number;
};
export function formatDuration(value: DurationLike): string {
const totalSeconds = Math.max(0, Math.floor(value.secs ?? 0));
const hours = Math.floor(totalSeconds / 3600)
.toString()
.padStart(2, "0");
const minutes = Math.floor((totalSeconds % 3600) / 60)
.toString()
.padStart(2, "0");
const seconds = (totalSeconds % 60).toString().padStart(2, "0");
return `${hours}:${minutes}:${seconds}`;
}