(time)
| 2 | * Format a timecode intro a hours:minutes:seconds:centiseconds string |
| 3 | */ |
| 4 | export function formatTimecode(time) { |
| 5 | const hours = time / 1000 / 60 / 60; |
| 6 | |
| 7 | const h = Math.floor(hours); |
| 8 | const m = Math.floor((hours - h) * 60); |
| 9 | const s = Math.floor(((hours - h) * 60 - m) * 60); |
| 10 | const c = Math.floor(((((hours - h) * 60 - m) * 60 - s) * 1000) / 10); |
| 11 | |
| 12 | return `${zeroPrefix(h)}:${zeroPrefix(m)}:${zeroPrefix(s)}:${zeroPrefix(c)}`; |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * Prefix a number with zero as a string if less than 10 |
no test coverage detected