MCPcopy
hub / github.com/ilyhalight/voice-over-translation / splitTimestampParts

Function splitTimestampParts

src/subtitles/standards.ts:111–127  ·  view source on GitHub ↗
(
  totalMs: number,
  normalizeMs: (value: number) => number,
)

Source from the content-addressed store, hash-verified

109};
110
111const splitTimestampParts = (
112 totalMs: number,
113 normalizeMs: (value: number) => number,
114): {
115 hours: number;
116 minutes: number;
117 seconds: number;
118 milliseconds: number;
119} => {
120 const safeMs = Math.max(0, normalizeMs(totalMs));
121 return {
122 hours: Math.floor(safeMs / 3_600_000),
123 minutes: Math.floor((safeMs % 3_600_000) / 60_000),
124 seconds: Math.floor((safeMs % 60_000) / 1000),
125 milliseconds: safeMs % 1000,
126 };
127};
128
129const formatAssTime = (totalMs: number): string => {
130 const { hours, minutes, seconds, milliseconds } = splitTimestampParts(

Callers 2

formatClockTimeFunction · 0.85
formatAssTimeFunction · 0.85

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected