From d0cfa44c8f7b7d77e6e89fba0138fcc002216610 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 May 2019 16:06:19 +0200 Subject: [PATCH] time/FileTime: use ToUint64() in DeltaFileTimeS() --- src/time/FileTime.hxx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/time/FileTime.hxx b/src/time/FileTime.hxx index 57632d428..542f84c85 100644 --- a/src/time/FileTime.hxx +++ b/src/time/FileTime.hxx @@ -61,16 +61,10 @@ FileTimeToChrono(FILETIME ft) noexcept return std::chrono::system_clock::from_time_t(FileTimeToTimeT(ft)); } -gcc_const -inline std::chrono::seconds +constexpr std::chrono::seconds DeltaFileTimeS(FILETIME a, FILETIME b) noexcept { - ULARGE_INTEGER a2, b2; - b2.LowPart = b.dwLowDateTime; - b2.HighPart = b.dwHighDateTime; - a2.LowPart = a.dwLowDateTime; - a2.HighPart = a.dwHighDateTime; - return std::chrono::seconds((a2.QuadPart - b2.QuadPart) / 10000000); + return std::chrono::seconds((ToUint64(a) - ToUint64(b)) / 10000000); } #endif