MCPcopy Create free account
hub / github.com/ampproject/amphtml / elapsedTimeWithCeiling

Function elapsedTimeWithCeiling

ads/google/a4a/utils.js:482–490  ·  view source on GitHub ↗

* @param {number} time * @param {number} start * @return {(number|string)}

(time, start)

Source from the content-addressed store, hash-verified

480 * @return {(number|string)}
481 */
482function elapsedTimeWithCeiling(time, start) {
483 const duration = time - start;
484 if (duration >= 1e6) {
485 return 'M';
486 } else if (duration >= 0) {
487 return duration;
488 }
489 return '-M';
490}
491
492/**
493 * `nodeOrDoc` must be passed for correct behavior in shadow AMP (PWA) case.

Callers 1

truncAndTimeUrlFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected