Sorting it all Out Michael Kaplan's random stuff of dubious value Be sure to read the disclaimer here first!
(Bonus geek points for anyone who can identify the language and meaning of the end of the title without searching the web for it!)
When you want to change the time zone, you have to have enough permission to do so.
And it is more than just having the permissions, it is also adding a special privilege to your application before it can set things up, as described in this topic.
Now which privilege do you need?
Well, in Windows 2000, XP, and Server 2003, the application must have the SE_SYSTEMTIME_NAME privilege before calling SetTimeZoneInformation.
In Vista, the application must have the new SE_TIME_ZONE_NAME privilege before calling either SetTimeZoneInformation or the new SetDynamicTimeZoneInformation function.
This information is in the updated help topics. However, the reasoning behind the change is not.
For that I had to contact Geoff Pease (knowledgable shell developer and the unofficial "Father Time" owner of most of what involves times zones and time on Windows). Geoff had the scoop on the intent of the new privilege:
The old CPL only let those with SE_SYSTEMTIME be able to open the CPL. Someone decided to give everyone the right to change their time zone independent of setting the current time (security vulnerability). So they added the SE_TIME_ZONE to separate the "powers" and thus give everyone the ability to enable that privilege by default.
And so, yhis one SE_SYSTEMTIME_NAME privilege gives permission in prior versions for both the time zone and the system time, and if you want to grant yourself permission, you must basically be an admin on the machine. Windows is telling you, in other words, Eto akta Gamat.
But in truth, the problems one can cause by changing the system time that lead to potential security issues do not really apply to the time zone setting. So the new SE_TIME_ZONE_NAME, which most people can grant themselves, is sll you need in Vista.
Now the SetTimeZoneInformation help topic in the Platform SDK has the same code sample that is has always had in it, so it tries to set the SE_SYSTEMTIME_NAME privilege, which can lead to a bit of confusion if one is running on Vista and wondering why the code is failing with an ERROR_PRIVILEGE_NOT_HELD error (1314).
One could argue that SE_SYSTEMTIME_NAME should imply SE_TIME_ZONE_NAME and if one did argue that, I would not disagree. But that is not what is currently happening, so you have to use that new privelege on Vista. Though as a bonus at least you are more likely to be able to now then you were before!
Just something to keep in mind if you run into problems....
And be sure to let me know if you earned those bonus geek points. Eto Akta Gamat! :-)
This post brought to you by ඎ (U+0d83, a.k.a. SINHALA LETTER IRUUYANNA)
Some of you fans of The Fifth Element may recall my post You want to change the time zone? Eto Akta Gamat!