Skip to content

Commit

Permalink
Merge pull request #145 from CookiePLMonster/y2038-fix
Browse files Browse the repository at this point in the history
Fix a Y2038 bug in timeToFILETIME
  • Loading branch information
gulrak committed Nov 18, 2022
2 parents cd6805e + 4f0824f commit 3e5b930
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/ghc/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2241,10 +2241,10 @@ GHC_INLINE time_t timeFromFILETIME(const FILETIME& ft)

GHC_INLINE void timeToFILETIME(time_t t, FILETIME& ft)
{
LONGLONG ll;
ll = Int32x32To64(t, 10000000) + 116444736000000000;
ft.dwLowDateTime = static_cast<DWORD>(ll);
ft.dwHighDateTime = static_cast<DWORD>(ll >> 32);
ULARGE_INTEGER ull;
ull.QuadPart = static_cast<ULONGLONG>((t * 10000000LL) + 116444736000000000LL);
ft.dwLowDateTime = ull.LowPart;
ft.dwHighDateTime = ull.HighPart;
}

template <typename INFO>
Expand Down

0 comments on commit 3e5b930

Please sign in to comment.