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

Function shouldUpdateStoredTime

src/service/cid-impl.js:673–677  ·  view source on GitHub ↗

* Whether we should write a new timestamp to the stored cid value. * We say yes if it is older than 1 day, so we only do this max once * per day to avoid writing to localStorage all the time. * @param {!BaseCidInfoDef} storedCidInfo * @return {boolean}

(storedCidInfo)

Source from the content-addressed store, hash-verified

671 * @return {boolean}
672 */
673function shouldUpdateStoredTime(storedCidInfo) {
674 const createdTime = storedCidInfo.time;
675 const now = Date.now();
676 return createdTime + ONE_DAY_MILLIS < now;
677}
678
679/**
680 * Returns an array with a total of 128 of random values based on the

Callers 1

getBaseCidFunction · 0.85

Calls 1

nowMethod · 0.80

Tested by

no test coverage detected