MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / timestampParts

Function timestampParts

packages/cli/src/whisper/normalize.ts:295–310  ·  view source on GitHub ↗
(seconds: number)

Source from the content-addressed store, hash-verified

293}
294
295function 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
312function pad2(n: number): string {
313 return n.toString().padStart(2, "0");

Callers 2

formatSrtTimestampFunction · 0.85
formatVttTimestampFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected