diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2022-12-17 13:09:33 +0200 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2023-01-04 19:15:52 +0200 |
commit | 41867c25f8438eb34dddba9d058e32c73638b4f5 (patch) | |
tree | 96424418b8ce04ebba0140c4bafaa8a1c9135aa7 /src/network/access/qnetworkdiskcache.cpp | |
parent | 7eff78e8a5ef484da973aa54ce689e3e266b1c69 (diff) |
Use QFileInfo's file times in UTC for file timestamps
This is inherently faster than getting it in UTC from the underlying
native API stat call, then converting it to the Local Time Zone just to
compare them. The same goes for any use-case where you get a QDateTime
then the first thing you do is call t.to{Msec,Secs}SinceEpoch().
Change-Id: Ic13bcfd99b937c9f10f102ea7741832950a553c6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Diffstat (limited to 'src/network/access/qnetworkdiskcache.cpp')
-rw-r--r-- | src/network/access/qnetworkdiskcache.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index 6b52b8d49a..72923543b5 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -493,9 +493,9 @@ qint64 QNetworkDiskCache::expire() QString path = info.filePath(); QString fileName = info.fileName(); if (fileName.endsWith(CACHE_POSTFIX)) { - const QDateTime birthTime = info.fileTime(QFile::FileBirthTime); + const QDateTime birthTime = info.birthTime(QTimeZone::UTC); cacheItems.insert(birthTime.isValid() ? birthTime - : info.fileTime(QFile::FileMetadataChangeTime), path); + : info.metadataChangeTime(QTimeZone::UTC), path); totalSize += info.size(); } } |