MCPcopy Create free account
hub / github.com/HamishMW/portfolio / formatTimecode

Function formatTimecode

app/utils/timecode.js:4–13  ·  view source on GitHub ↗
(time)

Source from the content-addressed store, hash-verified

2 * Format a timecode intro a hours:minutes:seconds:centiseconds string
3 */
4export 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

Callers 2

getPostsFunction · 0.90
loaderFunction · 0.90

Calls 1

zeroPrefixFunction · 0.85

Tested by

no test coverage detected