FW: Implementation of zoneinfo (Olson, tz) database in .NET c-sharp csharp

Kevin hellosticky at gmail.com
Sun Jul 1 14:26:27 UTC 2007


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 at cs.ucla.edu> wrote:
> "Olson, Arthur David (NIH/NCI) [E]" <olsona at dc37a.nci.nih.gov> writes:
>
> > From: Joshua Kifer [mailto:joshua at jotts.com]
> > Sent: Wednesday, June 20, 2007 8:33 PM
> >
> > http://www.codeplex.com/publicdomain
>
> 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



More information about the tz mailing list