MCPcopy Index your code
hub / github.com/Dimillian/CodexMonitor / normalizeTimestampMs

Function normalizeTimestampMs

src/features/threads/utils/threadRpc.ts:221–238  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

219}
220
221function normalizeTimestampMs(value: unknown): number | null {
222 if (typeof value === "number" && Number.isFinite(value) && value > 0) {
223 return value < 10_000_000_000 ? Math.trunc(value * 1000) : Math.trunc(value);
224 }
225 if (typeof value === "string" && value.trim()) {
226 const parsedNumber = Number(value);
227 if (Number.isFinite(parsedNumber) && parsedNumber > 0) {
228 return parsedNumber < 10_000_000_000
229 ? Math.trunc(parsedNumber * 1000)
230 : Math.trunc(parsedNumber);
231 }
232 const parsedDate = Date.parse(value);
233 if (Number.isFinite(parsedDate) && parsedDate > 0) {
234 return parsedDate;
235 }
236 }
237 return null;
238}
239
240function turnStartedAtMs(turn: Record<string, unknown>): number | null {
241 return (

Callers 1

turnStartedAtMsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected