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

Function parseSrtTimestamp

packages/cli/src/whisper/normalize.ts:253–262  ·  view source on GitHub ↗

Parse SRT timestamp: 00:01:23,456 → seconds

(ts: string)

Source from the content-addressed store, hash-verified

251
252/** Parse SRT timestamp: 00:01:23,456 → seconds */
253function parseSrtTimestamp(ts: string): number {
254 const m = ts.match(/(\d+):(\d+):(\d+)[,.](\d+)/);
255 if (!m) return 0;
256 return (
257 parseInt(m[1]!, 10) * 3600 +
258 parseInt(m[2]!, 10) * 60 +
259 parseInt(m[3]!, 10) +
260 parseInt(m[4]!.padEnd(3, "0"), 10) / 1000
261 );
262}
263
264/** Parse VTT timestamp: 00:01:23.456 or 01:23.456 → seconds */
265function parseVttTimestamp(ts: string): number {

Callers 2

parseSrtFunction · 0.85
parseVttTimestampFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected