/** ms → "m:ss" (1시간 넘으면 "h:mm:ss") */ export function fmtClock(ms: number): string { const neg = ms < 0; let s = Math.floor(Math.abs(ms) / 1000); const h = Math.floor(s / 3600); s -= h * 3600; const m = Math.floor(s / 60); s -= m * 60; const body = h > 0 ? `${h}:${String(m).padStart(2, '0')}:${String(s).padStart(2, '0')}` : `${m}:${String(s).padStart(2, '0')}`; return neg ? `-${body}` : body; } /** 현실 시각 → "HH:MM:SS" (Asia/Seoul) */ export function fmtReal(ts: number, tz = 'Asia/Seoul'): string { return new Intl.DateTimeFormat('ko-KR', { timeZone: tz, hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }).format(ts); }