time/FileTime: add ToUint64(FILETIME)

This commit is contained in:
Max Kellermann 2019-05-08 16:05:37 +02:00
parent a8fc805594
commit 5bae6946c6
1 changed files with 7 additions and 2 deletions

View File

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