static double currentAge(const ResourceResponse& response, double responseTimestamp) { // RFC2616 13.2.3 // No compensation for latency as that is not terribly important in practice double dateValue = response.date(); double apparentAge = std::isfinite(dateValue) ? std::max(0., responseTimestamp - dateValue) : 0; double ageValue = response.age(); double correctedReceivedAge = std::isfinite(ageValue) ? std::max(apparentAge, ageValue) : apparentAge; double residentTime = currentTime() - responseTimestamp; return correctedReceivedAge + residentTime; }