[tz] zic changes (1/2)

Arthur David Olson arthurdavidolson at gmail.com
Thu May 1 19:04:19 UTC 2014


A possibility mentioned last year at the time of the Macquarie fix:
here's a more general fix for zic.c. For clarity, it comes in two pieces.
This first piece simply rolls back the Macquarie-specific changes to zic.c;
it's both attached and appears in mangled form below. These changes are
relative to the git repository version.

    @dashdashado

1.1
2838 lines
1.2
2805 lines
*** /tmp/,azic.c    2014-05-01 01:51:26.531315400 -0400
--- /tmp/,bzic.c    2014-05-01 01:51:26.640515600 -0400
***************
*** 1480,1490 ****
          fromi = 0;
          while (fromi < timecnt && attypes[fromi].at < min_time)
              ++fromi;
!         /*
!         ** Remember that type 0 is reserved.
!         */
!         if (isdsts[1] == 0)
!             while (fromi < timecnt && attypes[fromi].type == 1)
                  ++fromi;    /* handled by default rule */
          for ( ; fromi < timecnt; ++fromi) {
              if (toi != 0 && ((attypes[fromi].at +
--- 1480,1487 ----
          fromi = 0;
          while (fromi < timecnt && attypes[fromi].at < min_time)
              ++fromi;
!         if (isdsts[0] == 0)
!             while (fromi < timecnt && attypes[fromi].type == 0)
                  ++fromi;    /* handled by default rule */
          for ( ; fromi < timecnt; ++fromi) {
              if (toi != 0 && ((attypes[fromi].at +
***************
*** 1589,1599 ****
          }
          thistimelim = thistimei + thistimecnt;
          thisleaplim = thisleapi + thisleapcnt;
!         /*
!         ** Remember that type 0 is reserved.
!         */
!         writetype[0] = FALSE;
!         for (i = 1; i < typecnt; ++i)
              writetype[i] = thistimecnt == timecnt;
          if (thistimecnt == 0) {
              /*
--- 1586,1592 ----
          }
          thistimelim = thistimei + thistimecnt;
          thisleaplim = thisleapi + thisleapcnt;
!         for (i = 0; i < typecnt; ++i)
              writetype[i] = thistimecnt == timecnt;
          if (thistimecnt == 0) {
              /*
***************
*** 1609,1619 ****
              /*
              ** For America/Godthab and Antarctica/Palmer
              */
-             /*
-             ** Remember that type 0 is reserved.
-             */
              if (thistimei == 0)
!                 writetype[1] = TRUE;
          }
  #ifndef LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH
          /*
--- 1602,1609 ----
              /*
              ** For America/Godthab and Antarctica/Palmer
              */
              if (thistimei == 0)
!                 writetype[0] = TRUE;
          }
  #ifndef LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH
          /*
***************
*** 1663,1688 ****
          }
  #endif /* !defined LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH */
          thistypecnt = 0;
-         /*
-         ** Potentially, set type 0 to that of lowest-valued time.
-         */
-         if (thistimei > 0) {
-             for (i = 1; i < typecnt; ++i)
-                 if (writetype[i] && !isdsts[i])
-                     break;
-             if (i != types[thistimei - 1]) {
-                 i = types[thistimei - 1];
-                 gmtoffs[0] = gmtoffs[i];
-                 isdsts[0] = isdsts[i];
-                 ttisstds[0] = ttisstds[i];
-                 ttisgmts[0] = ttisgmts[i];
-                 abbrinds[0] = abbrinds[i];
-                 writetype[0] = TRUE;
-                 writetype[i] = FALSE;
-             }
-         }
          for (i = 0; i < typecnt; ++i)
!             typemap[i] = writetype[i] ?  thistypecnt++ : 0;
          for (i = 0; i < sizeof indmap / sizeof indmap[0]; ++i)
              indmap[i] = -1;
          thischarcnt = 0;
--- 1653,1660 ----
          }
  #endif /* !defined LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH */
          thistypecnt = 0;
          for (i = 0; i < typecnt; ++i)
!             typemap[i] = writetype[i] ?  thistypecnt++ : -1;
          for (i = 0; i < sizeof indmap / sizeof indmap[0]; ++i)
              indmap[i] = -1;
          thischarcnt = 0;
***************
*** 2105,2115 ****
          updateminmax(leapminyear);
          updateminmax(leapmaxyear + (leapmaxyear < ZIC_MAX));
      }
-     /*
-     ** Reserve type 0.
-     */
-     gmtoffs[0] = isdsts[0] = ttisstds[0] = ttisgmts[0] = abbrinds[0] = -1;
-     typecnt = 1;
      for (i = 0; i < zonecount; ++i) {
          zp = &zpfirst[i];
          if (i < zonecount - 1)
--- 2077,2082 ----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mm.icann.org/pipermail/tz/attachments/20140501/8085712d/attachment.htm>
-------------- next part --------------
1.1
2838 lines
1.2
2805 lines
*** /tmp/,azic.c	2014-05-01 01:51:26.531315400 -0400
--- /tmp/,bzic.c	2014-05-01 01:51:26.640515600 -0400
***************
*** 1480,1490 ****
  		fromi = 0;
  		while (fromi < timecnt && attypes[fromi].at < min_time)
  			++fromi;
! 		/*
! 		** Remember that type 0 is reserved.
! 		*/
! 		if (isdsts[1] == 0)
! 			while (fromi < timecnt && attypes[fromi].type == 1)
  				++fromi;	/* handled by default rule */
  		for ( ; fromi < timecnt; ++fromi) {
  			if (toi != 0 && ((attypes[fromi].at +
--- 1480,1487 ----
  		fromi = 0;
  		while (fromi < timecnt && attypes[fromi].at < min_time)
  			++fromi;
! 		if (isdsts[0] == 0)
! 			while (fromi < timecnt && attypes[fromi].type == 0)
  				++fromi;	/* handled by default rule */
  		for ( ; fromi < timecnt; ++fromi) {
  			if (toi != 0 && ((attypes[fromi].at +
***************
*** 1589,1599 ****
  		}
  		thistimelim = thistimei + thistimecnt;
  		thisleaplim = thisleapi + thisleapcnt;
! 		/*
! 		** Remember that type 0 is reserved.
! 		*/
! 		writetype[0] = FALSE;
! 		for (i = 1; i < typecnt; ++i)
  			writetype[i] = thistimecnt == timecnt;
  		if (thistimecnt == 0) {
  			/*
--- 1586,1592 ----
  		}
  		thistimelim = thistimei + thistimecnt;
  		thisleaplim = thisleapi + thisleapcnt;
! 		for (i = 0; i < typecnt; ++i)
  			writetype[i] = thistimecnt == timecnt;
  		if (thistimecnt == 0) {
  			/*
***************
*** 1609,1619 ****
  			/*
  			** For America/Godthab and Antarctica/Palmer
  			*/
- 			/*
- 			** Remember that type 0 is reserved.
- 			*/
  			if (thistimei == 0)
! 				writetype[1] = TRUE;
  		}
  #ifndef LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH
  		/*
--- 1602,1609 ----
  			/*
  			** For America/Godthab and Antarctica/Palmer
  			*/
  			if (thistimei == 0)
! 				writetype[0] = TRUE;
  		}
  #ifndef LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH
  		/*
***************
*** 1663,1688 ****
  		}
  #endif /* !defined LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH */
  		thistypecnt = 0;
- 		/*
- 		** Potentially, set type 0 to that of lowest-valued time.
- 		*/
- 		if (thistimei > 0) {
- 			for (i = 1; i < typecnt; ++i)
- 				if (writetype[i] && !isdsts[i])
- 					break;
- 			if (i != types[thistimei - 1]) {
- 				i = types[thistimei - 1];
- 				gmtoffs[0] = gmtoffs[i];
- 				isdsts[0] = isdsts[i];
- 				ttisstds[0] = ttisstds[i];
- 				ttisgmts[0] = ttisgmts[i];
- 				abbrinds[0] = abbrinds[i];
- 				writetype[0] = TRUE;
- 				writetype[i] = FALSE;
- 			}
- 		}
  		for (i = 0; i < typecnt; ++i)
! 			typemap[i] = writetype[i] ?  thistypecnt++ : 0;
  		for (i = 0; i < sizeof indmap / sizeof indmap[0]; ++i)
  			indmap[i] = -1;
  		thischarcnt = 0;
--- 1653,1660 ----
  		}
  #endif /* !defined LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH */
  		thistypecnt = 0;
  		for (i = 0; i < typecnt; ++i)
! 			typemap[i] = writetype[i] ?  thistypecnt++ : -1;
  		for (i = 0; i < sizeof indmap / sizeof indmap[0]; ++i)
  			indmap[i] = -1;
  		thischarcnt = 0;
***************
*** 2105,2115 ****
  		updateminmax(leapminyear);
  		updateminmax(leapmaxyear + (leapmaxyear < ZIC_MAX));
  	}
- 	/*
- 	** Reserve type 0.
- 	*/
- 	gmtoffs[0] = isdsts[0] = ttisstds[0] = ttisgmts[0] = abbrinds[0] = -1;
- 	typecnt = 1;
  	for (i = 0; i < zonecount; ++i) {
  		zp = &zpfirst[i];
  		if (i < zonecount - 1)
--- 2077,2082 ----


More information about the tz mailing list