This commit is contained in:
rgrgogu
2026-05-20 13:25:03 +08:00
parent 2b1955608d
commit 95242709b0
71 changed files with 5535 additions and 1035 deletions
+13 -1
View File
@@ -10,4 +10,16 @@ export function getTimestamp() {
const SS = String(now.getSeconds()).padStart(2, "0");
return `${YYYY}${MM}${DD}_${HH}${mm}${SS}`;
}
}
export function formatDuration (secs) {
if (!secs) return "0 min";
const h = Math.floor(secs / 3600);
const m = Math.floor((secs % 3600) / 60);
const s = secs % 60;
const parts = [];
if (h) parts.push(`${h} hr`);
if (m) parts.push(`${m} min${m !== 1 ? "s" : ""}`);
if (!h && !m && s) parts.push(`${s} sec${s !== 1 ? "s" : ""}`);
return parts.join(" ");
};