Hi Yves,<br><br>There was an effort made a couple of years ago on CodePlex, implementing the TZDatabase.<br><br>Here&#39;s the link: <a href="http://publicdomain.codeplex.com/">http://publicdomain.codeplex.com/</a><br><br>
Regards,<br><br>Tom<br><br><div class="gmail_quote">On Thu, Jul 1, 2010 at 9:22 PM, Yves Goergen <span dir="ltr">&lt;<a href="mailto:nospam.list@unclassified.de">nospam.list@unclassified.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
<br>
I&#39;m currently implementing an API for the tz database that should look<br>
like .NET&#39;s TimeZoneInfo class to replace that in my application. The<br>
API includes:<br>
<br>
* Convert a date and time from UTC to a time zone<br>
* Convert a date and time from a time zone to UTC<br>
* Return the base UTC offset of a time zone for a date and time<br>
* Return the save offset of a time zone for a date and time<br>
* Determine whether a date and time is ambiguous in a time zone<br>
* Determine whether a date and time is invalid in a time zone<br>
<br>
It will come with a code generator that &quot;compiles&quot; the text files into<br>
C# code so that there&#39;s no need to deploy additional files with the<br>
application. The API&#39;s internal data structures are very similar to the<br>
tz database records, these are already coded.<br>
<br>
Currently I&#39;m stuck because of the flexibility of the tz rules. These<br>
can define transition times either in local, standard or universal time.<br>
Additionally, the caller of my API passes a date and time that is either<br>
local or universal. All this needs to be matched correctly. The right<br>
rule needs to be selected and there can be ambiguous or invalid times<br>
all along the way. It&#39;s not only hard to implement, it&#39;s also hard to<br>
describe, it&#39;s very confusing not to have a common base [zone] you can<br>
hold on to.<br>
<br>
I have now read about any manpage and code file from the tzcode<br>
distribution, starting with zic.c and going backwards in the list. I<br>
think the file localtime.c does the actual conversion but it&#39;s hard to<br>
read because it contains only few comments and uses short all-lowercase<br>
global variable names. I couldn&#39;t follow it to its core where the magic<br>
happens.<br>
<br>
I have analysed .NET&#39;s TimeZoneInfo implementation with .NET Reflector<br>
but it&#39;s not half as mighty as what the tz database can express. I also<br>
looked at the C# library ZoneInfo, but it uses an incompatible license,<br>
reads the text files at runtime and last but not least is quite inexact<br>
around transition times which it inacceptable for a calendar<br>
application. Also I think it&#39;s a good idea to write my own API for it<br>
because I&#39;ll need a Java port later as well, working on the exact same data.<br>
<br>
Could somebody assist me in this, please? Are there helpful thoughts to<br>
use when implementing such a programme? Right now my biggest problem is<br>
the transition times and in consequence finding the right rule to use<br>
for a given date and time.<br>
<font color="#888888"><br>
--<br>
Yves Goergen &quot;LonelyPixel&quot; &lt;<a href="mailto:nospam.list@unclassified.de">nospam.list@unclassified.de</a>&gt;<br>
Visit my web laboratory at <a href="http://beta.unclassified.de" target="_blank">http://beta.unclassified.de</a><br>
<br>
</font></blockquote></div><br>