Does anybody know a C function to convert time from UTC format (e.g. that
obtained by Windows calls like GetSystemTimeAsFileTime()) to time_t in
Windows?
I don’t want to use MFC for this.
Regards,
Siddharth.
Does anybody know a C function to convert time from UTC format (e.g. that
obtained by Windows calls like GetSystemTimeAsFileTime()) to time_t in
Windows?
I don’t want to use MFC for this.
Regards,
Siddharth.
Look for gmtime(), mktime(), and localtime(). The MSDN Library contains
the descriptions.
> Does anybody know a C function to convert time from UTC format (e.g. that
obtained by Windows calls like GetSystemTimeAsFileTime()) to time_t in
Windows?I don’t want to use MFC for this.
I convert C time to system time like this:
VOID CTimeToSystemTime(SYSTEMTIME &SystemTime, DWORD Value)
{
FILETIME FileTime;
ZeroStruct(SystemTime); // you can use own inline template function
SystemTime.wYear = 1970;
SystemTime.wDay = wMonth = 1;
SystemTimeToFileTime(&SystemTime, &FileTime);
((PLARGE_INTEGER)FileTime)->QuadPart += (LONGLONG)Value * 10000000;
FileTimeToLocalFileTime(&FileTime, &FileTime);
FileTimeToSystemTime(&FileTime, &SystemTime);
}
From here you can figure out how to make reverse conversion.
/regards/