Reputation: 1253
My PC is Windows 7 64-bit; I'm on the U.S. East coast (Eastern Time); the "Date and Time" applet -- reached by right-clicking on the taskbar clock and choosing "Adjust date/time" -- labels my time zone "(UTC-05:00) Eastern Time (U.S. & Canada)" and tells me that Daylight Savings Time ends in November. (For those coming along later, this was written in April, after we did the "spring forward" to get to Daylight Savings Time.)
Calling either the Windows GetTimeZoneInformation or GetDynamicTimeZoneInformation APIs (the latter only available on Vista or later) returns a "bias" value of 300 minutes, 5 hours. (The bias value is not negative because the doc for that value says "UTC = local time + bias".)
But if I go to the ISO web site that claims to show me the time on my computer it displays a time that matches a clock but ends -0400. (I tried to copy/paste it but it's difficult as it changes every second.) Typing "current time utc" into Google shows a time that is also 4 (not 5) hours ahead of the clock time here.
Confusing me a bit more -- I have an EC2 instance running Windows Server 2008 that someone else set up and said was intentionally set to GMT so that times recorded based on the server clock wouldn't have 1-hour jumps caused by Daylight Savings Time.
When I connect to that server, it shows a time 5 hours ahead of what I see here. But its Date/Time applet in Control Panel (different from Windows 7) shows that the current time zone is "(GMT) Greenwich Mean Time (Dublin, Edinburgh, Lisbon, London)" but there is also a time zone "(GMT) Coordinated Universal Time" -- UTC -- and if I change the time zone to that (something I think is correct), the offset is 4 hours.
The "Time Zone Settings" dialog on Windows 7 (reached by clicking the "Change time zone..." button on the "Date and Time" applet discussed above) has time zones labelled "(UTC) Coordinated Universal Time" (4 hours from now) and "(UTC) Dublin, Edinburgh, Lisbon, London" (5 hours from now).
Other than thinking that the EC2 instance had its time zone set wrong -- it should have been set to UTC not London time to accomplish the goal stated above -- I am not any further along in understanding this. Windows 7 in the U.S. says I'm 5 hours from UTC; everything else (including Windows 2008 set to UTC time) says 4 hours.
So what should a routine do to produce an ISO-style timestamp with a trailing timezone offset? The Windows API tells me it should be -0500, but everything else says it should be -0400. Help!!
Upvotes: 0
Views: 2110
Reputation: 241798
During Eastern Daylight Time, the offset is indeed UTC-04:00. The list of display names for time zones in Windows does not change to reflect this. It simply shows the the standard offset, which for Eastern Standard Time is UTC-05:00.
You are correct that the server should be set to "(UTC) Coordinated Universal Time" and not the setting labeled "(UTC) Dublin, Edinburgh, Lisbon, London". The "Coordinated Universal Time" setting is permanently fixed at UTC, where the other has a daylight offset which is UTC+01:00 during British Summer Time. Again, the label is only showing the standard offset, which is UTC+00:00, which is shortened in the display to just "(UTC)".
The only programming question you asked:
So what should a routine do to produce an ISO-style timestamp with a trailing timezone offset?
This depends highly on what language you are using. You mentioned the Win32 APIs for getting the system current time zone information, but one would rarely call these directly. Are you writing in C? C++? C#? VB? Java? Something Else? Please answer and I can answer this question.
Upvotes: 1