Enumerating Windows TimeZone information
Posted on 2003-11-08
I'm needing to be able to enumerate the available time zone lists so that I can use the bias details to fill a lpTimeZone structure ... and I haven't a clue how to go about it.
I suppose it is possible to walk through the different registry entries in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones and then decrypt the different binary storage values, but this seems *way* too inefficient.
I've tried searching msdn for variations of EnumTimeZones and different connotations to that effect and come up with a big fat zero.
What I am ultimately trying to do is give a user a list of time zones, as can be found in Adjust Date / Time in windows, so that they can choose a different locality to display a secondary clock that is different from their own.
For example, I'm in UK and want to have a dual clock that shows my current time alongside say current time in Tokyo, JP, and take into account daylight savings and such things.
In my investigations of how i might go about this, I've found the API call, SystemTimeToTzSpecificLocalTime, which I'm sure is the way i need to proceed to get this job done. But this function needs a fully built lpTimeZone structure to be able to pass back the alternative systemtime.
Therefore, if i can enumerate windows built in timezone structures, i can pass them in as required.
I'm guessing what I need to end up with from you people is a way to generate an array of fully built timezone structures from windows own time rules.
Another problem is that I'm not at all proficient in the use of the Win API
Any help is greatly appreciated - hence the generous points on offer
Many thanks in advance