Unix时间戳转FileTime

#define EPOCH_DIFF 116444736000000000          //FILETIME starts from 1601-01-01 UTC, epoch from 1970- 01-01
#define RATE_DIFF 10000000

void UnixTimeToFileTime(__time64_t tmUnixTime, LPFILETIME pFileTime)
{
    __int64 ll;

    ll = tmUnixTime * RATE_DIFF + EPOCH_DIFF;
    pFileTime->dwLowDateTime = (DWORD)ll;
    pFileTime->dwHighDateTime = ll >> 32;
}


 

你可能感兴趣的:(C/C++)