UTC: Coordinated Universal Time.

GMT: Greenwich Mean Time.

FILETIME:

LOCALTIME:

SYSTEMTIME:

STRUCTURE/DEFINITION

For windows

SYSTEMTIME structure. The time is either in coordinated universal time (UTC) or local time, depending on the function that is being called.

struct _SYSTEMTIME { 
WORD wYear;
WORD wMonth;          // based on 1(Jan)
WORD wDayOfWeek;      // 0 for sunday, 1 for monday, … 6 for saturday
WORD wDay;            // based on 1
WORD wHour;           // from 0 to 23
WORD wMinute;         // from 0 to 59
WORD wSecond;         // from 0 to 59
WORD wMilliseconds;   // from 0 to 999
} SYSTEMTIME;
FILETIME structure. This value represents the number of 100-nanosecond units since the beginning of January 1, 1601.
struct _FILETIME { 
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME, FAR *LPFILETIME;
ULARGE_INTEGER Union
struct {    
DWORD LowPart;
DWORD HighPart;
} u;
ULONGLONG QuadPart;
} ULARGE_INTEGER,
*PULARGE_INTEGER;
Note: As the structure shown above.
FILETIME –> ULARGE_INTEGER: Do not cast a pointer to a FILETIME structure to either a ULARGE_INTEGER* or __int64* value because it can cause alignment faults on 64-bit Windows. You should copy the low- and high-order parts of the file time to a ULARGE_INTEGER structure, perform 64-bit arithmetic on the QuadPart member.
ULARGE_INTEGER –> FILETIME: Cast pointer to ULARGE_INTEGER to FILETIME or copy the LowPart and HighPart members into the FILETIME structure.
long integer)
int  tm_isdst;
};

Retrieve Function

From total seconds (clocks) to tm structure for local time, lval is the variable for total seconds.

const time_t*)&t);
From total seconds (clocks) to tm structure for gmt time, lval is the variable for total seconds.
const tm*)pgtm);
From tm structure to calendar value
time_t _t = mktime(pltm);


相关文章: