proposed change to 'zic' to support "outlandish" offsets

Olson, Arthur David (NIH/NCI) [E] olsona at dc37a.nci.nih.gov
Thu May 3 15:00:29 UTC 2007


One possibility is to eliminate checks on hours greater than 24 in zic.c
(with warnings thrown in when they occur).
This minimizes changes that folks writing alternate parsers would need
to make; if we're really lucky, those folks aren't checking the range of
hours now and so won't need to make any changes.

Full-blown Julian work in the future would require more substantial
changes.

					--ado


------- zic.c -------
*** /tmp/geta18403	Thu May  3 10:59:07 2007
--- /tmp/getb18403	Thu May  3 10:59:07 2007
***************
*** 3,9 ****
  ** 2006-07-17 by Arthur David Olson.
  */
  
! static char	elsieid[] = "@(#)zic.c	8.12";
  
  #include "private.h"
  #include "locale.h"
--- 3,9 ----
  ** 2006-07-17 by Arthur David Olson.
  */
  
! static char	elsieid[] = "@(#)zic.c	8.13";
  
  #include "private.h"
  #include "locale.h"
***************
*** 945,959 ****
  			error(errstring);
  			return 0;
  	}
! 	if ((hh < 0 || hh >= HOURSPERDAY ||
  		mm < 0 || mm >= MINSPERHOUR ||
! 		ss < 0 || ss > SECSPERMIN) &&
! 		!(hh == HOURSPERDAY && mm == 0 && ss == 0)) {
  			error(errstring);
  			return 0;
  	}
! 	if (noise && hh == HOURSPERDAY)
  		warning(_("24:00 not handled by pre-1998 versions of
zic"));
  	return eitol(sign) *
  		(eitol(hh * MINSPERHOUR + mm) *
  		eitol(SECSPERMIN) + eitol(ss));
--- 945,961 ----
  			error(errstring);
  			return 0;
  	}
! 	if (hh < 0 ||
  		mm < 0 || mm >= MINSPERHOUR ||
! 		ss < 0 || ss > SECSPERMIN) {
  			error(errstring);
  			return 0;
  	}
! 	if (noise && hh == HOURSPERDAY && mm == 0 && ss == 0)
  		warning(_("24:00 not handled by pre-1998 versions of
zic"));
+ 	if (noise && (hh > HOURSPERDAY ||
+ 		(hh == HOURSPERDAY && (mm != 0 || ss != 0))))
+ warning(_("values over 24 hours not handled by pre-2007 versions of
zic"));
  	return eitol(sign) *
  		(eitol(hh * MINSPERHOUR + mm) *
  		eitol(SECSPERMIN) + eitol(ss));





More information about the tz mailing list