Commit 5bae6946 authored by Max Kellermann's avatar Max Kellermann

time/FileTime: add ToUint64(FILETIME)

parent a8fc8055
...@@ -42,11 +42,16 @@ ConstructUint64(DWORD lo, DWORD hi) noexcept ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment