FW: Implementation of zoneinfo (Olson, tz) database in .NET c-sharp csharp
I'm forwarding this message from Joshua Kifer, who is not on the time zone mailing list. Those of you who are on the time zone mailing list should direct replies appropriately. --ado From: Joshua Kifer [mailto:joshua@jotts.com] Sent: Wednesday, June 20, 2007 8:33 PM To: tz@lecserver.nci.nih.gov Subject: Implementation of zoneinfo (Olson, tz) database in .NET c-sharp csharp I finally found an implementation of this at CodePlex. It's part of the PublicDomain project. http://www.codeplex.com/publicdomain I hope this post adds some search fodder to the interweb for all those unlucky bastards seeking (and not finding) the same.
The maps of TimeZones that I have uncovered follow the country boundaries. Should the TimeZone Boundaries ideally follow international water boundaries? i.e. If one is boating 10 Kilometers off the coast of Senegal, would the ship be on 0 standard time (like the country of Senegal with international water rights), or would the ship be on -1 standard time? Is there any regard with time zones for international water boundaries? Let me know if I am not making myself clear! Thanks for your assistance. Christina Lawrence -----Original Message----- From: Olson, Arthur David (NIH/NCI) [E] [mailto:olsona@dc37a.nci.nih.gov] Sent: Thursday, June 21, 2007 9:00 AM To: tz@lecserver.nci.nih.gov Cc: joshua@jotts.com Subject: FW: Implementation of zoneinfo (Olson, tz) database in .NET c-sharp csharp I'm forwarding this message from Joshua Kifer, who is not on the time zone mailing list. Those of you who are on the time zone mailing list should direct replies appropriately. --ado From: Joshua Kifer [mailto:joshua@jotts.com] Sent: Wednesday, June 20, 2007 8:33 PM To: tz@lecserver.nci.nih.gov Subject: Implementation of zoneinfo (Olson, tz) database in .NET c-sharp csharp I finally found an implementation of this at CodePlex. It's part of the PublicDomain project. http://www.codeplex.com/publicdomain I hope this post adds some search fodder to the interweb for all those unlucky bastards seeking (and not finding) the same.
From what I understand, time in territorial waters is governed by the country in question. Normally, that would be the time of the coastal region in that country, unless it has a specific law otherwise.
In international waters, your time zone is LMT to the nearest hour-offset (so -7½ to +7½ is UTC, -22½ to -7½ is one hour behind, and so on). J Andrew Lipscomb, CPA*ABV, ASA Decosimo Corporate Finance 900 Tallan Building 2 Union Square Chattanooga, TN 37402 423.756.7100 Fax 423.266.6671 www.dcf.decosimo.com ________________________________ From: Christina Lawrence [mailto:CLawrence@stopwatchmaps.com] Sent: Thu 21 June 2007 12:45 To: tz@lecserver.nci.nih.gov Subject: TimeZones and international waters The maps of TimeZones that I have uncovered follow the country boundaries. Should the TimeZone Boundaries ideally follow international water boundaries? i.e. If one is boating 10 Kilometers off the coast of Senegal, would the ship be on 0 standard time (like the country of Senegal with international water rights), or would the ship be on -1 standard time? Is there any regard with time zones for international water boundaries? Let me know if I am not making myself clear! Thanks for your assistance. Christina Lawrence -----Original Message----- From: Olson, Arthur David (NIH/NCI) [E] [mailto:olsona@dc37a.nci.nih.gov] Sent: Thursday, June 21, 2007 9:00 AM To: tz@lecserver.nci.nih.gov Cc: joshua@jotts.com Subject: FW: Implementation of zoneinfo (Olson, tz) database in .NET c-sharp csharp I'm forwarding this message from Joshua Kifer, who is not on the time zone mailing list. Those of you who are on the time zone mailing list should direct replies appropriately. --ado From: Joshua Kifer [mailto:joshua@jotts.com] Sent: Wednesday, June 20, 2007 8:33 PM To: tz@lecserver.nci.nih.gov Subject: Implementation of zoneinfo (Olson, tz) database in .NET c-sharp csharp I finally found an implementation of this at CodePlex. It's part of the PublicDomain project. http://www.codeplex.com/publicdomain I hope this post adds some search fodder to the interweb for all those unlucky bastards seeking (and not finding) the same.
To help clear this up I'll add something like the following to my next proposed patch. Comments welcome. A ship within the territorial waters of any nation uses that nation's time. In international waters, time zone boundaries are meridians 15° apart, except that UTC−12 and UTC+12 are each 7.5° wide and are separated by the 180° meridian (not by the International Date Line, which is for land and territorial waters only). A captain can change ship's clocks any time after entering a new time zone; midnight changes are common.
Thank you for the response! What distance from shore defines "the territorial waters of any nation"? Is it nation specific, or an internationally recognized distance from shore? Thank you! Christina -----Original Message----- From: Paul Eggert [mailto:eggert@CS.UCLA.EDU] Sent: Thursday, June 21, 2007 12:56 PM To: tz@elsie.nci.nih.gov Cc: Christina Lawrence Subject: Re: TimeZones and international waters To help clear this up I'll add something like the following to my next proposed patch. Comments welcome. A ship within the territorial waters of any nation uses that nation's time. In international waters, time zone boundaries are meridians 15° apart, except that UTC−12 and UTC+12 are each 7.5° wide and are separated by the 180° meridian (not by the International Date Line, which is for land and territorial waters only). A captain can change ship's clocks any time after entering a new time zone; midnight changes are common.
Generally, the territorial waters extend 12 miles from shore. In cases of conflict (ie, a point is less than 12 miles from the shores of two or more countries), the dividing line is established by treaty. I think there are still a few areas where treaties have not been adopted, so there might be some "gray" areas... International Treaties permit definition of "Economic Excclusion Zones" (the US EEZ is a 200-mile limit). Fishing limits apply in such areas, but boarding rights and controls over shipping etc. don not apply. Paul Goyette Juniper Networks Customer Service and former skipper of the 61' Cheoy Lee motor yacht "Gentle Wind" on her 2005 journey across the Pacific Ocean.
-----Original Message----- From: Christina Lawrence [mailto:CLawrence@stopwatchmaps.com] Sent: Sunday, July 01, 2007 11:38 AM To: Paul Eggert Cc: tz@lecserver.nci.nih.gov Subject: RE: TimeZones and international waters
Thank you for the response!
What distance from shore defines "the territorial waters of any nation"? Is it nation specific, or an internationally recognized distance from shore?
Thank you!
Christina
-----Original Message----- From: Paul Eggert [mailto:eggert@CS.UCLA.EDU] Sent: Thursday, June 21, 2007 12:56 PM To: tz@elsie.nci.nih.gov Cc: Christina Lawrence Subject: Re: TimeZones and international waters
To help clear this up I'll add something like the following to my next proposed patch. Comments welcome.
A ship within the territorial waters of any nation uses that nation's time. In international waters, time zone boundaries are meridians 15° apart, except that UTC−12 and UTC+12 are each 7.5° wide and are separated by the 180° meridian (not by the International Date Line, which is for land and territorial waters only). A captain can change ship's clocks any time after entering a new time zone; midnight changes are common.
"Christina Lawrence" <CLawrence@stopwatchmaps.com> writes:
What distance from shore defines "the territorial waters of any nation"? Is it nation specific, or an internationally recognized distance from shore?
Sorry, but (like anything involving lawyers :-) it's complicated. Please see <http://en.wikipedia.org/wiki/Territorial_waters> for some details. I'll add that URL too, in my next proposed patch.
"Olson, Arthur David (NIH/NCI) [E]" <olsona@dc37a.nci.nih.gov> writes:
From: Joshua Kifer [mailto:joshua@jotts.com] Sent: Wednesday, June 20, 2007 8:33 PM
Thanks for mentioning that. Do you know how it works? It appears to have a copy of the tz database, translated into C# (how?). Suppose a new version of the tz database comes out: how would the change be propagated?
Good question. I took a look through the source code and the database has been converted into XML. (Just do a grep on Pacific). What I found was that the only thing being retained is the timezone name and its UTC offset. No historical data is utilized. Unfortunate, but at least my company can refrain from any longer utilizing the undocumented and non-standard timezone information in the Windows registry (the indices of which actually changed in Windows Vista, preventing us from upgrading our services to that OS if we had desired to, or desire to in the future). Joshua
-----Original Message----- From: Paul Eggert [mailto:eggert@CS.UCLA.EDU] Sent: Thursday, June 21, 2007 10:35 AM To: Joshua Kifer Cc: tz@elsie.nci.nih.gov Subject: Re: FW: Implementation of zoneinfo (Olson, tz) database in .NET c-sharp csharp
"Olson, Arthur David (NIH/NCI) [E]" <olsona@dc37a.nci.nih.gov> writes:
From: Joshua Kifer [mailto:joshua@jotts.com] Sent: Wednesday, June 20, 2007 8:33 PM
Thanks for mentioning that. Do you know how it works? It appears to have a copy of the tz database, translated into C# (how?).
Suppose a new version of the tz database comes out: how would the change be propagated?
"Joshua Kifer" <joshua@jottnetworks.com> writes:
the only thing being retained is the timezone name and its UTC offset. No historical data is utilized.
Thanks. Here's a draft of what could go into tz-link.htm; comments and corrections are welcome. <li><a href="http://www.codeplex.com/publicdomain">PublicDomain</a> has a copy of a recent <code>tz</code> database, accessed via a <a href="http://en.wikipedia.org/wiki/C_Sharp">C#</a> library. As its name suggests, it is in the public domain. Only current time stamps are supported; historical data are not used.</li>
the undocumented and non-standard timezone information in the Windows registry (the indices of which actually changed in Windows Vista, preventing us from upgrading our services to that OS if we had desired to, or desire to in the future).
Ouch. Does this mean that the Windows-Tzid table maintained by the CLDR project is incorrect, or that CLDR needs a new table for Vista? If so, we should warn the CLDR folks about the problem. Please see <http://unicode.org/cldr/data/diff/supplemental/windows_tzid.html>. Also, does this mean that the Wikipedia coverage of this topic is incorrect and/or incomplete? Wikipedia addresses some of the issues with Microsoft Windows and DST, but it doesn't mention the issue of index changes in Vista. Please see <http://en.wikipedia.org/wiki/Daylight_saving_time#Microsoft_Windows>. (See what you get for being helpful? People keep asking you questions. :-)
Please see: http://www.codeproject.com/dotnet/WorldClock.asp We are using the 'Index' value for our indexing. These Indexes changed in Vista. I don't see where the shorter text id's exist in the registry. At least they are not referenced or documented in the fore-mentioned project. And yeah, I see what you mean by being helpful. :)
-----Original Message----- From: Paul Eggert [mailto:eggert@CS.UCLA.EDU] Sent: Thursday, June 21, 2007 12:31 PM To: Joshua Kifer Cc: tz@elsie.nci.nih.gov Subject: Re: Implementation of zoneinfo (Olson, tz) database in .NET c- sharp csharp
"Joshua Kifer" <joshua@jottnetworks.com> writes:
the only thing being retained is the timezone name and its UTC offset. No historical data is utilized.
Thanks. Here's a draft of what could go into tz-link.htm; comments and corrections are welcome.
<li><a href="http://www.codeplex.com/publicdomain">PublicDomain</a> has a copy of a recent <code>tz</code> database, accessed via a <a href="http://en.wikipedia.org/wiki/C_Sharp">C#</a> library. As its name suggests, it is in the public domain. Only current time stamps are supported; historical data are not used.</li>
the undocumented and non-standard timezone information in the Windows registry (the indices of which actually changed in Windows Vista, preventing us from upgrading our services to that OS if we had desired to, or desire to in the future).
Ouch. Does this mean that the Windows-Tzid table maintained by the CLDR project is incorrect, or that CLDR needs a new table for Vista? If so, we should warn the CLDR folks about the problem. Please see <http://unicode.org/cldr/data/diff/supplemental/windows_tzid.html>.
Also, does this mean that the Wikipedia coverage of this topic is incorrect and/or incomplete? Wikipedia addresses some of the issues with Microsoft Windows and DST, but it doesn't mention the issue of index changes in Vista. Please see <http://en.wikipedia.org/wiki/Daylight_saving_time#Microsoft_Windows>.
(See what you get for being helpful? People keep asking you questions. :-)
On 6/22/2007 4:31 AM, Paul Eggert wrote:
Does this mean that the Windows-Tzid table maintained by the CLDR project is incorrect, or that CLDR needs a new table for Vista? If so, we should warn the CLDR folks about the problem. Please see <http://unicode.org/cldr/data/diff/supplemental/windows_tzid.html>.
Some time ago I pointed out that there's no concept of tzid on Windows, and I asked how CLDR got these "Windows-Tzids." But I don't think I got any answer. The Java runtime uses the GetTimeZoneInformation() and "Time Zones" registry values to detect the current Windows time zone and map it to a tz database ID using some complicated method. You may want to check <JRE_HOME>\lib\tzmappings in JRE/JDK 6 for Windows and the runtime code for detecting the current Windows time zone. The source code can be downloaded from http://download.java.net/openjdk/jdk7/. Masayoshi
Masayoshi.Okutsu@Sun.COM wrote on 06/22/2007 07:31:53 AM:
On 6/22/2007 4:31 AM, Paul Eggert wrote:
Does this mean that the Windows-Tzid table maintained by the CLDR project is incorrect, or that CLDR needs a new table for Vista? If so, we should warn the CLDR folks about the problem. Please see <http://unicode.org/cldr/data/diff/supplemental/windows_tzid.html>.
Some time ago I pointed out that there's no concept of tzid on Windows, and I asked how CLDR got these "Windows-Tzids." But I don't think I got any answer.
These is no concept of tzid on Windows, but at least MS maintains registry keys under - HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones My understanding is that CLDR folks assumed these "time-zone strings" as tzids. MS defines a sort of tzids called "CodTimeZoneId" for Exchange/Outlook. http://msdn2.microsoft.com/en-us/library/ms526601.aspx These are obviously a subset of Windows "Time Zones" registries.
The Java runtime uses the GetTimeZoneInformation() and "Time Zones" registry values to detect the current Windows time zone and map it to a tz database ID using some complicated method. You may want to check <JRE_HOME>\lib\tzmappings in JRE/JDK 6 for Windows and the runtime code for detecting the current Windows time zone. The source code can be downloaded from http://download.java.net/openjdk/jdk7/.
Masayoshi
Windows used to support only a pair of DST start/end rules per zone, but MS finlally implemented a framework for supporting historic changes since Windows Vista. http://msdn2.microsoft.com/en-us/library/ms724253.aspx I do not think this enhancement has any impacts to Java runtime on Windows although. Yoshito
yoshito_umaoka@us.ibm.com writes:
Windows used to support only a pair of DST start/end rules per zone, but MS finlally implemented a framework for supporting historic changes since Windows Vista.
That URL says that the framework isn't implemented yet. The server side is scheduled to go out in Windows Server 2008 (aka "Longhorn"). Also, as far as I can tell, the client side supports only one rule change. For example, in the US a single Vista setting might support both 1987-2006 and post-2006 time stamps, but it wouldn't also support pre-1987 time stamps. At least, that is what I think <http://msdn2.microsoft.com/en-us/vstudio/bb264729.aspx> says (it's a bit hard to follow). I don't use Vista so I can't easily verify this myself, but if this information is incorrect, please let us know, as the Wikipedia entry <http://en.wikipedia.org/wiki/Daylight_saving_time#Microsoft_Windows> should get corrected. Let's hope that some day Microsoft will catch up to what the public-domain tz code was doing back in 1986. (Good work, Arthur!)
Paul Eggert <eggert@CS.UCLA.EDU> wrote on 06/22/2007 10:55:28 AM:
yoshito_umaoka@us.ibm.com writes:
Windows used to support only a pair of DST start/end rules per zone, but MS finlally implemented a framework for supporting historic changes since Windows Vista.
That URL says that the framework isn't implemented yet. The server side is scheduled to go out in Windows Server 2008 (aka "Longhorn").
Right. That's why I wrote - "since Windows Vista".
Also, as far as I can tell, the client side supports only one rule change. For example, in the US a single Vista setting might support both 1987-2006 and post-2006 time stamps, but it wouldn't also support pre-1987 time stamps. At least, that is what I think <http://msdn2.microsoft.com/en-us/vstudio/bb264729.aspx> says (it's a bit hard to follow). I don't use Vista so I can't easily verify this myself, but if this information is incorrect, please let us know, as the Wikipedia entry <http://en.wikipedia.org/wiki/Daylight_saving_time#Microsoft_Windows> should get corrected.
I think what you wrote is true at least for now. I actually do not have a copy of Windows Vista, but I once checked the keys on someone else's system briefly. What I found was, as you described, some zones has one previous rule change. But, regarding to the API and KB docs, my understanding is that you can add historic/future rules as many as you want and MS would do it for any future changes. So my point is - Windows Vista (and Longhorn) should be capable to support proper time stamps before 1986, but the data is not provided by MS at least for now. Yoshito
The .NET Framework 3.5 will support custom time zones using the System.TimeZoneInfo class. The link below is to the Microsoft Base Class Library's own blog, and Microsoft has, in the comments to this entry, specifically addressed (by saying "it's the developer's problem") the Olson TZ database: http://blogs.msdn.com/bclteam/archive/2007/06/07/exploring-windows-time-zone s-with-system-timezoneinfo-josh-free.aspx David Braverman Inner Drive Technology Evanston, Ill.
Hi tzlist, I created this PublicDomain package as well as the tz database integration. I had been meaning to notify the list, but the current support is quite experimental, so I was waiting until I could make it more robust to get public comments... Alas, I got caught up in creating a start-up (of which this PublicDomain set of classes is an off-shoot). I guess the cat's out of the bag :-) That's okay, and if anyone is interested in contributing, that would be greatly appreciated. A response to the questions is below.... On 6/21/07, Paul Eggert <eggert@cs.ucla.edu> wrote:
"Olson, Arthur David (NIH/NCI) [E]" <olsona@dc37a.nci.nih.gov> writes:
From: Joshua Kifer [mailto:joshua@jotts.com] Sent: Wednesday, June 20, 2007 8:33 PM
Thanks for mentioning that. Do you know how it works? It appears to have a copy of the tz database, translated into C# (how?).
There is a class called TzDatabase which parses the tz database into logical constructs, then emits C# code, which is manually placed into the static initializer, and the whole package is recompiled. This adds a few seconds to each static initialization of the class, which is the trade off for not performing File I/O on DLL resources or the filesystem (mostly for security permission reasons).
Suppose a new version of the tz database comes out: how would the change be propagated?
A new version of PublicDomain would have to be created and this new DLL would be re-downloaded and installed (no automatic way of doing this). I am *very* open to criticisms. If there is a better way to implement tz database support, I would be interested; however, one of the main design goals was to require very little from the "integrator" (i.e. the consumer of PublicDomain and TzTimeZone/TzDateTime). Therefore, using resource files which must be loaded from the DLL or file system would require FileIOPermission, and I felt that a larger load time (due to static initialization) and the tz database compiled in was the better choice. I am open to changing this. By the way, if you install PublicDomain.msi, all code is placed into C:\Program Files\PublicDomain\ (it is not yet tested on Linux), including TzDatabase.cs, TzDateTime.cs, and TzTimeZone.cs. Thanks, Kevin Grigorenko
"Joshua Kifer" <joshua@jottnetworks.com> writes:
the only thing being retained is the timezone name and its UTC offset. No historical data is utilized.
Thanks. Here's a draft of what could go into tz-link.htm; comments and corrections are welcome.
<li><a href="http://www.codeplex.com/publicdomain">PublicDomain</a> has a copy of a recent <code>tz</code> database, accessed via a <a href="http://en.wikipedia.org/wiki/C_Sharp">C#</a> library. As its name suggests, it is in the public domain. Only current time stamps are supported; historical data are not used.</li>
By the way, the historical data exists, I just haven't implemented accessor methods to retrieve that data. This data is already compiled in to the runtime binary. However, it can be retrieved manually through the TzDatabase class, although that requires a local copy of the tz database. Thanks, Kevin
participants (10)
-
Andy Lipscomb -
Christina Lawrence -
David Braverman -
Joshua Kifer -
Kevin -
Masayoshi Okutsu -
Olson, Arthur David (NIH/NCI) [E] -
Paul Eggert -
Paul Goyette -
yoshito_umaoka@us.ibm.com