[tz] Behaviour in the face of multiple identical rules

Jon Skeet skeet at pobox.com
Sun Jul 19 17:24:38 UTC 2015


This is more of an awareness-raising post than anything else... the data
here is very far in the past.

While trying to validate Noda Time against zic, I came up against issues
with data releases between 1993 and 1996 in Egypt/Cairo. It turns out that
this is because the Egypt rule is duplicated in the asia file, and this
affects things.

As a smallish example, if you create a file called testzone like this:

Rule    Egypt   1900    only    -       Oct      1      0:00    0       -
> Rule    Egypt   1943    1945    -       Nov      1      0:00    0       -
> Rule    Egypt   1945    only    -       Apr     16      0:00    1:00    "
> DST"
> Rule    Egypt   1957    only    -       May     10      0:00    1:00    "
> DST"
> Rule    Egypt   1957    1958    -       Oct      1      0:00    0       -
> Rule    Egypt   1958    only    -       May      1      0:00    1:00    "
> DST"
> # Rule  Egypt   1957    only    -       May     10      0:00    1:00    "
> DST"
>
> # Zone  NAME            GMTOFF  RULES   FORMAT  [UNTIL]
> Zone    Africa/Cairo    2:05:00 -       LMT     1900 Oct
>                         2:00    Egypt   EET%s


... then execute:

$ zic -d . testzone && zdump -v -c 1955,1958 $PWD/Africa/Cairo

You'll see output like this for the May 1957 transition:

.../Africa/Cairo  Thu May  9 21:59:59 1957 UT = Thu May  9 23:59:59 1957
> EET isdst=0 gmtoff=7200
> ...Africa/Cairo  Thu May  9 22:00:00 1957 UT = Fri May 10 01:00:00 1957
> EET DST isdst=1 gmtoff=10800


That looks okay - the transition is around midnight, as described.

If, however, you uncomment that last "Rule" line above - which is an exact
duplicate of the earlier one - you get:

.../Africa/Cairo  Thu May  9 20:59:59 1957 UT = Thu May  9 22:59:59 1957
> EET isdst=0 gmtoff=7200
> .../Africa/Cairo  Thu May  9 21:00:00 1957 UT = Fri May 10 00:00:00 1957
> EET DST isdst=1 gmtoff=10800


Now the transition is one hour earlier.

As it happens, this duplicate rule doesn't make any difference to Noda Time
- it still emits the first output.

I *strongly suspect* that I shouldn't care about this - that situations
with duplicate rules should be deemed out of scope for any implementation.
However, if anyone can think of any good justification why an
implementation *should* behave like zic in this case, I'd be really
interested to hear it.

(I'm not asking for zic to change here. It already emits a warning because
the rule is defined in multiple files, and I think that's good enough.)

Jon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mm.icann.org/pipermail/tz/attachments/20150719/49fafaf2/attachment.html>


More information about the tz mailing list