1

如何在 Windows 内核模式下获取 UTC 时间?

我知道 KeQuerySystemTime (但这是基于 1601 的)。

我找到了这个解决方案。

LONGLONG FileTime_to_POSIX(FILETIME ft)
{
    // takes the last modified date
    LARGE_INTEGER date, adjust;

    date.HighPart = ft.dwHighDateTime;
    date.LowPart = ft.dwLowDateTime;

    // 100-nanoseconds = milliseconds * 10000
    adjust.QuadPart = 11644473600000 * 10000;

    // removes the diff between 1970 and 1601
    date.QuadPart -= adjust.QuadPart;

    // converts back from 100-nanoseconds to seconds
    return date.QuadPart / 10000000;
}

但这似乎是错误的,我对其进行了测试,大约错了 10 秒

4

0 回答 0