QNetworkReplyHttpImpl: convert another QDateTime::currentDateTime() to currentDateTimeUtc()
The latter is much faster as it doesn't have to deal with time zones. This change is safe because QNetworkHeadersPrivate::fromHttpDate(), used as the QDateTime source in other, nearby, code paths, also returns only UTC date-times. So not only is this change faster at the call site, it also avoids inconsistent-timespec comparisons down the line. Credits to Milian Wolff, from whose QtWS15 talk this advice is taken. Change-Id: I26d308a2763cc45d28bc96871e651f30b17a6b85 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>bb10
parent
3880f41e68
commit
5d849880f4
|
|
@ -1585,7 +1585,7 @@ QNetworkCacheMetaData QNetworkReplyHttpImplPrivate::fetchCacheMetaData(const QNe
|
|||
QByteArray maxAge = cacheControl.value("max-age");
|
||||
if (!maxAge.isEmpty()) {
|
||||
checkExpired = false;
|
||||
QDateTime dt = QDateTime::currentDateTime();
|
||||
QDateTime dt = QDateTime::currentDateTimeUtc();
|
||||
dt = dt.addSecs(maxAge.toInt());
|
||||
metaData.setExpirationDate(dt);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue