1 Windows 下
void UTC2Local(SYSTEMTIME& utcTime, SYSTEMTIME& localTime) |
TIME_ZONE_INFORMATION timeZoneInfo; |
GetTimeZoneInformation(&timeZoneInfo); |
SystemTimeToTzSpecificLocalTime(&timeZoneInfo,&utcTime,&localTime); |
2 CE/Windows Mobile 下
由于在CE下没有提供函数 SystemTimeToTzSpecificLocalTime,所以采用以下的方法:
1 | void UTC2Local(SYSTEMTIME& utcTime, SYSTEMTIME& localTime) |
3 | FILETIME utcFileTime,localFileTime; |
4 | SystemTimeToFileTime(&utcTime,&utcFileTime); |
5 | FileTimeToLocalFileTime(&utcFileTime,&localFileTime); |
6 | FileTimeToSystemTime(&localFileTime,&localTime); |