[MS] When working with Win32 FILETIME, don't forget that you have std::chrono now - devamazonaws.blogspot.com
Some time ago, I was looking at a pull request, and saw that the code was manually calculating the "number of minutes since the last change" by doing annoying math. static const DWORD c_TicksPerSecond = 10000000; static const DWORD c_SecondsPerMinute = 60; uint64_t FileTimeToULongLong(FILETIME time) { ULARGE_INTEGER value; value.LowPart = time.dwLowDateTime; value.HighPart = time.dwHighDateTime; return value.QuadPart; } DWORD GetMinutesSinceLastChange() { FILETIME now; GetSystemTimeAsFileTime(&now); uint64_t now64 = FileTimeToULongLong(now); uint64_t last64 = FileTimeToULongLong(m_lastChange); if (now64 < last64) { return 0; } uint64_t diff = last64 - now64; return static_cast<DWORD>(diff / (static_cast<uint64_t>(c_dwSecondsPerMinute) * static_cast<uint64_t>(c_TicksPerSecond))); } Okay, first of all, we have helpers in the Windows Implementation Library (wil) to save you ...