The Old New Thing

On the various ways of getting the current time and date in Win32

There are a number of functions in Win32 that obtain the current date and time. Here's how they fit together: The starting point is . This returns the current time in UTC in the form of a structure. This also happens to be the time format used internally by the system, so this value can be retrieved with a minimum of fuss. You can also ...

How do I parse a string into a FILETIME?

Public Service Announcement: Daylight Saving Time ends in most parts of the United States this weekend. Other parts of the world may change on a different day from the United States. The NLS functions in Win32 provide functions to convert a into a string, but it does not provide any functions to perform the reverse conversion. Here are ...

How do I generate a unique 32-bit value for a time zone?

Public Service Announcement: Daylight Saving Time ends in most parts of the United States this weekend. Other parts of the world may change on a different day from the United States. A customer asked the following question: Given two structures, I would like to compute a for each that I can then compare to determine whether they ...

Why does my TIME_ZONE_INFORMATION have the wrong DST cutover date?

Public Service Announcement: Daylight Saving Time begins in most parts of the United States this weekend. Other parts of the world may change on a different day from the United States. A customer reported that they were getting incorrect values from the function. I have a program that calls , and it looks like it's returning incorrect DST ...

Why does the Win32 Time service require the date to be correct before it will set the time?

Public Service Announcement: Daylight Saving Time ends in most parts of the United States this weekend. Andy points out that if you attempt to synchronize your clock when the date is set incorrectly, the operation fails with the error message "An error occurred while Windows was synchronizing with time.windows.com. For security reasons, ...