[tz] FW: missing extension rules
Zefram
zefram at fysh.org
Tue Oct 11 20:44:09 UTC 2011
I've found that zic normally copes correctly with zones that are
configured to observe DST rules and the ruleset has no future transitions.
The problem with Africa/Cairo is that when looking for the last rule
zic gets confused by there being two transitions in a single month.
It fails to distinguish between their dates, and incorrectly ends up
thinking that the transition to DST was latest.
The attached patch fixes this bug. Africa/Cairo is the only tzfile
affected by the change, and the only change to it is to fill the
POSIX-TZ field.
I also pointed out America/Argentina/San_Luis. It turns out that zic
is deliberately declining to fill the POSIX-TZ field, because of the
DSTness of the last observation. This is the same reason why it left
that field empty in Africa/Cairo, once it had made the mistake about
which observation came last. I have a plan for improving this situation,
which I'll address in a separate patch.
-zefram
-------------- next part --------------
diff -ur tz2011j.build/zic.c tz2011j.mod1/zic.c
--- tz2011j.build/zic.c 2011-06-15 11:46:58.000000000 +0100
+++ tz2011j.mod1/zic.c 2011-10-11 21:34:44.000000000 +0100
@@ -1951,12 +1951,15 @@
** There are no rules running through "max".
** Let's find the latest rule.
*/
+ zic_t when_latest = 0;
for (i = 0; i < zp->z_nrules; ++i) {
+ zic_t when;
rp = &zp->z_rules[i];
- if (stdrp == NULL || rp->r_hiyear > stdrp->r_hiyear ||
- (rp->r_hiyear == stdrp->r_hiyear &&
- rp->r_month > stdrp->r_month))
- stdrp = rp;
+ when = rpytime(rp, rp->r_hiyear);
+ if (stdrp == NULL || when > when_latest) {
+ stdrp = rp;
+ when_latest = when;
+ }
}
if (stdrp != NULL && stdrp->r_stdoff != 0)
return; /* We end up in DST (a POSIX no-no). */
More information about the tz
mailing list