November 08, 2008

What happened to LocalFileTimeToFileTime() / FileTimeToLocalFileTime()?

When you want to convert a time between UTC and local, you may choose the API LocalFileTimeToFileTime() or FileTimeToLocalFileTime() for this job.

Do you know you may get an unexpected result if it is daylight saving time?

LocalFileTimeToFileTime() and FileTimeToLocalFileTime() use the current settings for the time zone and daylight saving time. Therefore, if it is daylight saving time, these functions will take daylight saving time into account, even if the time you are converting is in standard time.

You can use SystemTimeToTzSpecificLocalTime() and TzSpecificLocalTimeToSystemTime() instead.

Reference in This Site:

Reference in MSDN: