#include "stdafx.h"
#include "TimeFunctions.h"

#pragma unmanaged

TimeFunctions::TimeFunctions()
{
}


void TimeFunctions::UnixTimeToFileTime(time_t t, LPFILETIME pft)
{
	// Note that LONGLONG is a 64-bit value
	LONGLONG ll;

	ll = Int32x32To64(t, 10000000) + 116444736000000000;
	pft->dwLowDateTime = (DWORD)ll;
	pft->dwHighDateTime = ll >> 32;
}

 void TimeFunctions::UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst)
{
	FILETIME ft;
	UnixTimeToFileTime(t, &ft);
	FileTimeToSystemTime(&ft, pst);
}