While the system uses UTC-based time internally, your applications will generally display the local time — the date and time of day for your time zone. Therefore, to ensure correct results, you must be aware of whether a function expects to receive a UTC-based time or a local time, and whether the function returns a UTC-based time or a local time.
You can retrieve the local time by using the GetLocalTime function. GetLocalTime converts the system time to a local time based on the current time-zone settings and copies the result to a SYSTEMTIME structure. You can set the system time by using the SetLocalTime function. SetLocalTime assumes you have specified a local time and converts to UTC before setting the system time.
Windows NT: When you call SetLocalTime, Windows NT uses the current time zone information, including the Daylight Saving Time setting, to perform the conversion. Note that Windows NT uses the Daylight Saving Time setting of the current time, not the new time you are setting. Therefore, to ensure the correct result, call SetLocalTime again, now that the Daylight Saving Time setting is set for the new time.
The current time-zone settings control how the system converts between UTC and local time. You can retrieve the current time-zone settings by using the GetTimeZoneInformation function. The function copies the setting to a TIME_ZONE_INFORMATION structure and returns a value indicating whether local time is currently in standard or daylight-savings time. You can set the time-zone settings by using the SetTimeZoneInformation function.
To convert a UTC-based time stored in a SYSTEMTIME structure to a local time, use the SystemTimeToTzSpecificLocalTime function. SystemTimeToTzSpecifcLocalTime uses the current settings for the time zone and daylight saving time. Therefore, if it is daylight saving time, this function will take daylight saving time into account, even if the time you are converting is in standard time.