Bug 1407245 Fix service worker update 24-hour time check conversion from microseconds. r=asuth

This commit is contained in:
Ben Kelly 2017-10-10 13:50:36 -07:00
parent cf897d6fcb
commit fa33ed763d

View File

@ -346,14 +346,14 @@ ServiceWorkerRegistrationInfo::IsLastUpdateCheckTimeOverOneDay() const
}
const int64_t kSecondsPerDay = 86400;
const int64_t now =
const int64_t nowMicros =
mCreationTime + static_cast<PRTime>((TimeStamp::Now() -
mCreationTimeStamp).ToMicroseconds());
// now < mLastUpdateTime if the system time is reset between storing
// and loading mLastUpdateTime from ServiceWorkerRegistrar.
if (now < mLastUpdateTime ||
(now - mLastUpdateTime) / PR_MSEC_PER_SEC > kSecondsPerDay) {
if (nowMicros < mLastUpdateTime ||
(nowMicros - mLastUpdateTime) / PR_USEC_PER_SEC > kSecondsPerDay) {
return true;
}
return false;