(seconds: number)
| 293 | } |
| 294 | |
| 295 | function timestampParts(seconds: number): { |
| 296 | hours: number; |
| 297 | minutes: number; |
| 298 | wholeSeconds: number; |
| 299 | milliseconds: number; |
| 300 | } { |
| 301 | const safeSeconds = Number.isFinite(seconds) ? seconds : 0; |
| 302 | const totalMs = Math.max(0, Math.round(safeSeconds * 1000)); |
| 303 | const milliseconds = totalMs % 1000; |
| 304 | const totalSeconds = (totalMs - milliseconds) / 1000; |
| 305 | const wholeSeconds = totalSeconds % 60; |
| 306 | const totalMinutes = (totalSeconds - wholeSeconds) / 60; |
| 307 | const minutes = totalMinutes % 60; |
| 308 | const hours = (totalMinutes - minutes) / 60; |
| 309 | return { hours, minutes, wholeSeconds, milliseconds }; |
| 310 | } |
| 311 | |
| 312 | function pad2(n: number): string { |
| 313 | return n.toString().padStart(2, "0"); |
no outgoing calls
no test coverage detected