MCPcopy Index your code
hub / github.com/nodejs/node / getTimerDuration

Function getTimerDuration

lib/internal/timers.js:421–436  ·  view source on GitHub ↗
(msecs, name)

Source from the content-addressed store, hash-verified

419
420// Type checking used by timers.enroll() and Socket#setTimeout()
421function getTimerDuration(msecs, name) {
422 validateNumber(msecs, name);
423 if (msecs < 0 || !NumberIsFinite(msecs)) {
424 throw new ERR_OUT_OF_RANGE(name, 'a non-negative finite number', msecs);
425 }
426
427 // Ensure that msecs fits into signed int32
428 if (msecs > TIMEOUT_MAX) {
429 process.emitWarning(`${msecs} does not fit into a 32-bit signed integer.` +
430 `\nTimer duration was truncated to ${TIMEOUT_MAX}.`,
431 'TimeoutOverflowWarning');
432 return TIMEOUT_MAX;
433 }
434
435 return msecs;
436}
437
438function compareTimersLists(a, b) {
439 const expiryDiff = a.expiry - b.expiry;

Callers 3

ClientRequestFunction · 0.85
_http_client.jsFile · 0.85
setStreamTimeoutFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…