MCPcopy Create free account
hub / github.com/SamuelZ12/longcut / formatSrtTimestamp

Function formatSrtTimestamp

lib/transcript-export.ts:34–46  ·  view source on GitHub ↗
(seconds: number)

Source from the content-addressed store, hash-verified

32}
33
34function formatSrtTimestamp(seconds: number): string {
35 const totalMilliseconds = Math.max(0, Math.round(seconds * 1000));
36 const hours = Math.floor(totalMilliseconds / 3_600_000);
37 const minutes = Math.floor((totalMilliseconds % 3_600_000) / 60_000);
38 const secs = Math.floor((totalMilliseconds % 60_000) / 1000);
39 const millis = totalMilliseconds % 1000;
40
41 return `${hours.toString().padStart(2, '0')}:${minutes
42 .toString()
43 .padStart(2, '0')}:${secs.toString().padStart(2, '0')},${millis
44 .toString()
45 .padStart(3, '0')}`;
46}
47
48function getSegmentSpeaker(segment: TranscriptSegment): string | undefined {
49 if (!segment) return undefined;

Callers 1

generateSrtContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected