Created
November 29, 2021 11:48
-
-
Save autch/02e74d84f185a717ddfcecf2a6883e4c to your computer and use it in GitHub Desktop.
Get FILETIME (Windows) value as of 1970-01-01T00:00:00Z
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <stdio.h> | |
int main() | |
{ | |
SYSTEMTIME st; | |
FILETIME ft; | |
ULARGE_INTEGER ulft; | |
// 1970-01-01T00:00:00Z | |
st.wYear = 1970; | |
st.wMonth = 1; | |
st.wDayOfWeek = 4; | |
st.wDay = 1; | |
st.wHour = 0; | |
st.wMinute = 0; | |
st.wSecond = 0; | |
st.wMilliseconds = 0; | |
if(!SystemTimeToFileTime(&st, &ft)) | |
{ | |
fprintf(stderr, "SystemTimeToFileTime() failed, GLE=%d\n", GetLastError()); | |
return 1; | |
} | |
ulft.HighPart = ft.dwHighDateTime; | |
ulft.LowPart = ft.dwLowDateTime; | |
printf("%llu", ulft.QuadPart); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
116444736000000000