MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / spanTimeInputToSeconds

Function spanTimeInputToSeconds

packages/core/src/utils/spanUtils.ts:143–158  ·  view source on GitHub ↗
(input: SpanTimeInput | undefined)

Source from the content-addressed store, hash-verified

141 * Convert a span time input into a timestamp in seconds.
142 */
143export function spanTimeInputToSeconds(input: SpanTimeInput | undefined): number {
144 if (typeof input === 'number') {
145 return ensureTimestampInSeconds(input);
146 }
147
148 if (Array.isArray(input)) {
149 // See {@link HrTime} for the array-based time format
150 return input[0] + input[1] / 1e9;
151 }
152
153 if (input instanceof Date) {
154 return ensureTimestampInSeconds(input.getTime());
155 }
156
157 return timestampInSeconds();
158}
159
160/**
161 * Converts a timestamp to second, if it was in milliseconds, or keeps it as second.

Callers 10

spanUtils.test.tsFile · 0.90
updateStartTimeMethod · 0.90
endMethod · 0.90
addEventMethod · 0.90
applyFunction · 0.90
parseSentrySpanArgumentsFunction · 0.90
spanToJSONFunction · 0.85
spanToStreamedSpanJSONFunction · 0.85

Calls 2

timestampInSecondsFunction · 0.90
ensureTimestampInSecondsFunction · 0.85

Tested by

no test coverage detected