Hello Guys,
I work with windows 10 and VisualStudio; I should transform window FileTime in Unix time (Epoch time); I found the formula to convert the number of seconds in the windows FileTime to number of seconds in the Unix time: Unix time = (windows FileTime/10000000) - 11644473600.
In order to work with the window file time structure I have to “copy the low- and high-order parts of the file time to a ULARGE_INTEGER structure, perform 64-bit arithmetic on the QuadPart member” (from Microsoft doc).
What is not clear to me and I would like to ask you is: what is the relation bewtween low – high parts and the QuadPart? If I print these three numbers (see code below), I do not see the relation.
Here we have the code:
Code:
#include <stdio.h>
#include <windows.h>
int main()
{
ULARGE INTEGER U;
FILETIME T;
GetSystemTimeAsFileTime(&T);
U.LowPart=T.dwLowDateTime;
U.HighPart=T.dwHighDateTime;
printf(“Windows FileTime, QuadPart: %llu \n HighPart: %lu \n LowPart: %lu \n”, U.QuadPart, U.HighPart, U.LowPart);
//Unix time calculation:
U.QuadPart = U.QuadPart/10000000 – 11644473600;
printf(“Unix Time: %llu \n”, U.QuadPart);
return 1;
}
Thank you for your help
Kind regards