diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-10-23 16:32:59 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-01-04 12:58:41 +0000 |
commit | 5d849880f4225717b76fb95d9c6a5dd9614ac7be (patch) | |
tree | 8d5af05f2ed2a0b58f14faa87f8a231681dcb35c /src | |
parent | 3880f41e683f02b905c8cbc3c578c3f3a0a1eb2e (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/network/access/qnetworkreplyhttpimpl.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index ad8a5321b4..04d391a14c 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -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); } |