Export (0) Print
Expand All

Converting a time_t Value to a File Time

The time functions included in the C run-time use the time_t type to represent the number of seconds elapsed since midnight, January 1, 1970. The following example converts a time_t value to a file time, using the Int32x32To64 function.


#include <windows.h>
#include <time.h>

void TimetToFileTime( time_t t, LPFILETIME pft )
{
    LONGLONG ll = Int32x32To64(t, 10000000) + 116444736000000000;
    pft->dwLowDateTime = (DWORD) ll;
    pft->dwHighDateTime = ll >>32;
}


After you have obtained a file time, you can convert this value to system time using the FileTimeToSystemTime function.

 

 

Community Additions

ADD
Show:
© 2015 Microsoft