Programming Tips - Win32: convert from UTC/GMT to local time

Date: 2018apr27 OS: Windows Language: C/C++ Q. Win32: convert from UTC/GMT to local time A. Convert utc SYTEMTIME -> utc FILETIME -> local FILETIME -> local SYSTEMTIME like this
void UtcToLocal(const SYSTEMTIME *pstUtc, SYSTEMTIME *pstLocal) { FILETIME ftUtc, ftLocal; SystemTimeToFileTime(pstUtc, &ftUtc); FileTimeToLocalFileTime(&ftUtc, &ftLocal); FileTimeToSystemTime(&ftLocal, pstLocal); }
Based on https://support.microsoft.com/en-ca/help/245786/how-to-convert-from-gmt-utc-time-to-local-time