Question

My application converts past and present dates from local time to UTC.

I need to ensure I will honor any future DST updates to Windows while still correctly handling past dates.

The application is written in C++ and is running on Server 2003.

Options I've researched:

So...

  • ... is anyone else using the raw registry solution to do this?

  • ... any other suggestions?

(edit: found out dst_calc_engine doesn't support DST updates)

Was it helpful?

Solution

I think I'd prefer to re-implement GetTimeZoneInformationForYear and possibly GetDynamicTimeZoneInformation based on the information in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.

That way, your code will follow Windows updates and you can swap the dirty code out for the actual implementation on up-level platforms.

Since you don't want to use an external database, I think no other options are viable.

OTHER TIPS

You could use gmtime() and localtime() for dates in 2007 and later (and take advantage of Windows DST updates), and use Boost or one of the other solutions you mentioned to use the correct DST rules for 2006 and earlier.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top