tz93c botches time zone transitions in Brazil

Paul Eggert eggert at twinsun.com
Fri Jun 18 03:14:49 UTC 1993


Ed Reingold noticed that SunOS 4.1.2 mishandles the time zone transitions in
Brazil.  Typically, it claims that the transitions occur on Friday, whereas
the rule says they should occur on Saturday.  The bug is still present in
tz93c (the 1993-06-06 version of the time zone code).

I looked into the problem, and discovered that zic botches any rule whose ON
field is of the form `DAY<=N', where DAY is not Sunday, and where the Nth day
of the current year is not DAY.  In this case, it acts as if you specified the
previous day to DAY.  As it happens, the only rules of this form in the
database are those of Brazil.  For example if you run `zdump -v Brazil/East'
you'll see that most of the transitions occur on Friday, but they're all
supposed to occur on Saturday.

Here is a patch to tz93c.  I'm amazed that this bug has never been reported in
all these years.  Shall we chalk it up to Brazil's strict import restrictions
on American software?

===================================================================
RCS file: zic.c,v
retrieving revision 7.8
retrieving revision 7.8.1.1
diff -c -r7.8 -r7.8.1.1
*** zic.c	1993/06/06 23:31:38	7.8
--- zic.c	1993/06/18 02:58:46	7.8.1.1
***************
*** 1819,1825 ****
  			} else {
  				dayoff = oadd(dayoff, (long) -1);
  				if (--wday < 0)
! 					wday = LDAYSPERWEEK;
  				--i;
  			}
  		if (i < 0 || i >= len_months[isleap(y)][m]) {
--- 1819,1825 ----
  			} else {
  				dayoff = oadd(dayoff, (long) -1);
  				if (--wday < 0)
! 					wday = LDAYSPERWEEK - 1;
  				--i;
  			}
  		if (i < 0 || i >= len_months[isleap(y)][m]) {



More information about the tz mailing list