time/FileTime: add ToUint64(FILETIME)

This commit is contained in:
Max Kellermann 2019-05-08 16:05:37 +02:00
parent a8fc805594
commit 5bae6946c6

View File

@ -42,11 +42,16 @@ ConstructUint64(DWORD lo, DWORD hi) noexcept
return uint64_t(lo) | (uint64_t(hi) << 32); return uint64_t(lo) | (uint64_t(hi) << 32);
} }
constexpr uint64_t
ToUint64(FILETIME ft) noexcept
{
return ConstructUint64(ft.dwLowDateTime, ft.dwHighDateTime);
}
constexpr time_t constexpr time_t
FileTimeToTimeT(FILETIME ft) noexcept FileTimeToTimeT(FILETIME ft) noexcept
{ {
return (ConstructUint64(ft.dwLowDateTime, ft.dwHighDateTime) return (ToUint64(ft) - 116444736000000000) / 10000000;
- 116444736000000000) / 10000000;
} }
inline std::chrono::system_clock::time_point inline std::chrono::system_clock::time_point