Test cases for zoneinfo data

Christopher Hunt huntc at internode.on.net
Thu Dec 16 23:35:21 UTC 2010


Firstly, thanks for the responses. My responses are inline below.

>> I'm creating a set of Java classes that closely reflect the structure of 
> the 
>> Zoneinfo database. My requirement is driven mostly by wanting to 
>> dynamically update Java TimeZone classes i.e. as opposed to compiling a 
>> zoneinfo data and re-starting my application.
> 
> You probably want to look into JSR-310. TZDBZoneRulesCompiler in JSR-310 
> creates ZoneRules from the tz database source files.
Ah - I certainly didn't know about this so thanks for the "heads-up". At first glance though, I don't see that Zoneinfo's structures are being faithfully reproduced here. I suppose another motivation for me was to stick to the Zoneinfo structure given that it is highly evolved and flexible. Please see the attached class diagram of what I'm working to and do feel free to voice your opinion. ZoneinfoTimeZone is a JDK compatible TimeZone facade whereas the rest are intended to represent Zoneinfo structures in an object oriented manner.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Zoneinfo TZ.png
Type: image/png
Size: 43638 bytes
Desc: not available
Url : http://mm.icann.org/pipermail/tz/attachments/20101217/4925539e/ZoneinfoTZ-0001.png 
-------------- next part --------------


> 
>> In addition I feel that the 
>> ICU and Sun classes do not accurately reflect Zoneinfo structures.
> 
> Well, ICU (and Sun/Oracle) have to gather daylight saving amount (usually 
> 1 hour, but some exceptions) information because Calendar API expose it. 
> However, zic does not preserve the daylight saving amount information in 
> the output files. Other than daylight saving amount information, ICU (and 
> Sun/Oracle JDK, if my understanding is correct) duplicate the structure 
> logically. ICU also adds some extra aliases for backward compatibility 
> support purpose.
Interesting. My approach is to hydrate the Zoneinfo files into Java objects and then process rules as required.

> 
>> 
>> I shall open-source this project once it gets to a working point.
>> 
>> It'd be terribly helpful if I could get hold of some test cases, 
> automated 
>> or otherwise, that verify correct time zone calculations. Would anyone 
>> out there have such things?
>> 
> 
> In ICU project, we use slightly modified version of zdump and compare the 
> output with the one generated by ICU's TimeZone implementation. You may 
> consider similar method for testing your implementation.
That's a good idea. Thanks.

Kind regards,
Christopher


More information about the tz mailing list