[tz] Troll throws zic for a loop

Zefram zefram at fysh.org
Thu Mar 20 09:36:52 UTC 2014

Paul Eggert wrote:
>                       complained '"test.tzi", line 8: too many
>transitions?! (rule from "test.tzi", line 2)'.  I guess this is some
>sort of limitation in either zic or the tz binary file format.

It's zic.  The four-transitions-per-year pattern can't be represented
as a POSIXish-TZ value, so the 400-year hack applies.  That requires
writing out somewhat over 1600 explicit transitions.  The tzfile format
has no problem with this, but zic uses a statically-allocated array
of 1200 elements to accumulate the transitions during compilation.
Once that array is full, you get the error message.

The quick fix is to bump 1200 (TZ_MAX_TIMES in tzfile.h) up to 2000.
But it's a fundamentally flawed system.  zic should dynamically reallocate
its array as required, starting from a much smaller size.  The same goes
for localtime.c, which uses the same transition limit.  Existing Olson
localtime.c won't be able to use the Troll tzfile once it's generated by
a more capable zic.  Other tzfile parsers will vary in their ability to
handle it.  Just one more data point: glibc's tzfile parser dynamically
allocates space and so should handle the Troll tzfile just fine.


More information about the tz mailing list