time/FileTime: use ToUint64() in DeltaFileTimeS()

This commit is contained in:
Max Kellermann 2019-05-08 16:06:19 +02:00
parent 5bae6946c6
commit d0cfa44c8f

View File

@ -61,16 +61,10 @@ FileTimeToChrono(FILETIME ft) noexcept
return std::chrono::system_clock::from_time_t(FileTimeToTimeT(ft)); return std::chrono::system_clock::from_time_t(FileTimeToTimeT(ft));
} }
gcc_const constexpr std::chrono::seconds
inline std::chrono::seconds
DeltaFileTimeS(FILETIME a, FILETIME b) noexcept DeltaFileTimeS(FILETIME a, FILETIME b) noexcept
{ {
ULARGE_INTEGER a2, b2; return std::chrono::seconds((ToUint64(a) - ToUint64(b)) / 10000000);
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);
} }
#endif #endif