Proposed changes to tz package

Olson, Arthur David (NIH/NCI) olsona at dc37a.nci.nih.gov
Thu Dec 4 17:19:40 UTC 2003


Here are proposed change to the time zone package. Included:
	* corrections of the spelling of UNIX and of its trademark holder.
	* correct version number in iso3166.tab
	* normalize format of comments in localtime.c
	* change mktime to search temporally backward through used time
	  corrections when making DST adjustments
	* change Makefile to generate text versions of man pages
	  and to check for uses of 24:00 in input files
	* change northamerica to avoid use of 24:00
	  and to normalize a date appearing in a comment
	* add workman.sh script for generating text versions of man pages
	* change zic.c to warn about use of 24:00 if the -v option is used
	* change zic.8 to document warnings about 24:00 

				--ado

------- europe -------
*** /tmp/geta11168	Thu Dec  4 12:00:25 2003
--- /tmp/getb11168	Thu Dec  4 12:00:25 2003
***************
*** 1,4 ****
! # @(#)europe	7.84
  
  # This data is by no means authoritative; if you think you know better,
  # go ahead and edit the file (and please send any changes to
--- 1,4 ----
! # @(#)europe	7.85
  
  # This data is by no means authoritative; if you think you know better,
  # go ahead and edit the file (and please send any changes to
***************
*** 1831,1837 ****
  #
  # From Andrey A. Chernov <ache at nagual.ru> (1996-10-04):
  # `MSK' and `MSD' were born and used initially on Moscow computers with
! # Unix-like OSes by several developer groups (e.g. Demos group, Kiae
group)....
  # The next step was the UUCP network, the Relcom predecessor
  # (used mainly for mail), and MSK/MSD was actively used there.
  #
--- 1831,1837 ----
  #
  # From Andrey A. Chernov <ache at nagual.ru> (1996-10-04):
  # `MSK' and `MSD' were born and used initially on Moscow computers with
! # UNIX-like OSes by several developer groups (e.g. Demos group, Kiae
group)....
  # The next step was the UUCP network, the Relcom predecessor
  # (used mainly for mail), and MSK/MSD was actively used there.
  #

------- iso3166.tab -------
*** /tmp/geta11187	Thu Dec  4 12:00:25 2003
--- /tmp/getb11187	Thu Dec  4 12:00:25 2003
***************
*** 1,6 ****
  # ISO 3166 alpha-2 country codes
  #
! # @(#)iso3166.tab	1.9
  #
  # From Paul Eggert <eggert at twinsun.com> (2003-02-04):
  #
--- 1,6 ----
  # ISO 3166 alpha-2 country codes
  #
! # @(#)iso3166.tab	1.14
  #
  # From Paul Eggert <eggert at twinsun.com> (2003-02-04):
  #

------- localtime.c -------
*** /tmp/geta11206	Thu Dec  4 12:00:25 2003
--- /tmp/getb11206	Thu Dec  4 12:00:25 2003
***************
*** 5,11 ****
  
  #ifndef lint
  #ifndef NOID
! static char	elsieid[] = "@(#)localtime.c	7.76";
  #endif /* !defined NOID */
  #endif /* !defined lint */
  
--- 5,11 ----
  
  #ifndef lint
  #ifndef NOID
! static char	elsieid[] = "@(#)localtime.c	7.78";
  #endif /* !defined NOID */
  #endif /* !defined lint */
  
***************
*** 1053,1060 ****
  }
  
  /*
!  * Re-entrant version of localtime
!  */
  struct tm *
  localtime_r(timep, tm)
  const time_t * const	timep;
--- 1053,1061 ----
  }
  
  /*
! ** Re-entrant version of localtime.
! */
! 
  struct tm *
  localtime_r(timep, tm)
  const time_t * const	timep;
***************
*** 1113,1120 ****
  }
  
  /*
!  * Re-entrant version of gmtime
!  */
  struct tm *
  gmtime_r(timep, tm)
  const time_t * const	timep;
--- 1114,1122 ----
  }
  
  /*
! * Re-entrant version of gmtime.
! */
! 
  struct tm *
  gmtime_r(timep, tm)
  const time_t * const	timep;
***************
*** 1503,1508 ****
--- 1505,1515 ----
  	register time_t			t;
  	register const struct state *	sp;
  	register int			samei, otheri;
+ 	register int			sameind, otherind;
+ 	register int			i;
+ 	register int			nseen;
+ 	int				seen[TZ_MAX_TYPES];
+ 	int				types[TZ_MAX_TYPES];
  	int				okay;
  
  	if (tmp->tm_isdst > 1)
***************
*** 1536,1545 ****
  	if (sp == NULL)
  		return WRONG;
  #endif /* defined ALL_STATE */
! 	for (samei = sp->typecnt - 1; samei >= 0; --samei) {
  		if (sp->ttis[samei].tt_isdst != tmp->tm_isdst)
  			continue;
! 		for (otheri = sp->typecnt - 1; otheri >= 0; --otheri) {
  			if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst)
  				continue;
  			tmp->tm_sec += sp->ttis[otheri].tt_gmtoff -
--- 1543,1562 ----
  	if (sp == NULL)
  		return WRONG;
  #endif /* defined ALL_STATE */
! 	for (i = 0; i < sp->typecnt; ++i)
! 		seen[i] = FALSE;
! 	nseen = 0;
! 	for (i = sp->timecnt - 1; i >= 0; --i)
! 		if (!seen[sp->types[i]]) {
! 			seen[sp->types[i]] = TRUE;
! 			types[nseen++] = sp->types[i];
! 		}
! 	for (sameind = 0; sameind < nseen; ++sameind) {
! 		samei = types[sameind];
  		if (sp->ttis[samei].tt_isdst != tmp->tm_isdst)
  			continue;
! 		for (otherind = 0; otherind < nseen; ++otherind) {
! 			otheri = types[otherind];
  			if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst)
  				continue;
  			tmp->tm_sec += sp->ttis[otheri].tt_gmtoff -

------- Makefile -------
*** /tmp/geta11225	Thu Dec  4 12:00:26 2003
--- /tmp/getb11225	Thu Dec  4 12:00:26 2003
***************
*** 1,4 ****
! # @(#)Makefile	7.83
  
  # Change the line below for your time zone (after finding the zone you
want in
  # the time zone files, or adding it to a time zone file).
--- 1,4 ----
! # @(#)Makefile	7.89
  
  # Change the line below for your time zone (after finding the zone you
want in
  # the time zone files, or adding it to a time zone file).
***************
*** 268,274 ****
  WEB_PAGES=	tz-art.htm tz-link.htm
  MISC=		usno1988 usno1989 usno1989a usno1995 usno1997 usno1998 \
  			$(WEB_PAGES) checktab.awk
! ENCHILADA=	$(DOCS) $(SOURCES) $(DATA) $(MISC)
  
  # And for the benefit of csh users on systems that assume the user
  # shell should be used to handle commands in Makefiles. . .
--- 268,274 ----
  WEB_PAGES=	tz-art.htm tz-link.htm
  MISC=		usno1988 usno1989 usno1989a usno1995 usno1997 usno1998 \
  			$(WEB_PAGES) checktab.awk
! ENCHILADA=	$(DOCS) $(SOURCES) $(DATA) $(MISC) workman.sh
  
  # And for the benefit of csh users on systems that assume the user
  # shell should be used to handle commands in Makefiles. . .
***************
*** 383,392 ****
  
  public:		$(ENCHILADA) zic
  		-mkdir /tmp/,tzpublic
! 		for i in $(TDATA) ; do zic -d /tmp/,tzpublic $$i ; done
  		rm -f -r /tmp/,tzpublic
  		$(AWK) -f checktab.awk $(PRIMARY_YDATA)
! 		tar cf - $(DOCS) $(SOURCES) $(MISC) | gzip -9 >
tzcode.tar.gz
  		tar cf - $(DATA) | gzip -9 > tzdata.tar.gz
  
  zonenames:	$(TDATA)
--- 383,394 ----
  
  public:		$(ENCHILADA) zic
  		-mkdir /tmp/,tzpublic
! 		-for i in $(TDATA) ; do zic -v -d /tmp/,tzpublic $$i 2>&1 |
grep -v "starting year" ; done
! 		for i in $(TDATA) ; do zic -d /tmp/,tzpublic $$i; done
  		rm -f -r /tmp/,tzpublic
+ 		for i in *.[1-8] ; do sh workman.sh $$i > $$i.txt; done
  		$(AWK) -f checktab.awk $(PRIMARY_YDATA)
! 		tar cf - $(DOCS) $(SOURCES) $(MISC) *.[1-8].txt | gzip -9 >
tzcode.tar.gz
  		tar cf - $(DATA) | gzip -9 > tzdata.tar.gz
  
  zonenames:	$(TDATA)

------- northamerica -------
*** /tmp/geta11244	Thu Dec  4 12:00:26 2003
--- /tmp/getb11244	Thu Dec  4 12:00:26 2003
***************
*** 1,4 ****
! # @(#)northamerica	7.63
  # also includes Central America and the Caribbean
  
  # This data is by no means authoritative; if you think you know better,
--- 1,4 ----
! # @(#)northamerica	7.65
  # also includes Central America and the Caribbean
  
  # This data is by no means authoritative; if you think you know better,
***************
*** 405,411 ****
  			-7:00	-	MST
  # From Arthur David Olson (1988-02-13):
  # A writer from the Inter Tribal Council of Arizona, Inc.,
! # notes in private correspondence dated 12/28/87 that "Presently, only the
  # Navajo Nation participates in the Daylight Saving Time policy, due to
its
  # large size and location in three states."  (The "only" means that other
  # tribal nations don't use DST.)
--- 405,411 ----
  			-7:00	-	MST
  # From Arthur David Olson (1988-02-13):
  # A writer from the Inter Tribal Council of Arizona, Inc.,
! # notes in private correspondence dated 1987-12-28 that "Presently, only
the
  # Navajo Nation participates in the Daylight Saving Time policy, due to
its
  # large size and location in three states."  (The "only" means that other
  # tribal nations don't use DST.)
***************
*** 951,958 ****
  Rule	Mont	1924	only	-	May	17	2:00	1:00	D
  Rule	Mont	1924	1926	-	Sep	lastSun	2:30	0	S
  Rule	Mont	1925	1926	-	May	Sun>=1	2:00	1:00	D
! Rule	Mont	1927	1937	-	Apr	lastSat	24:00	1:00	D
! Rule	Mont	1927	1937	-	Sep	lastSat	24:00	0	S
  Rule	Mont	1938	1940	-	Apr	lastSun	0:00	1:00	D
  Rule	Mont	1938	1939	-	Sep	lastSun	0:00	0	S
  Rule	Mont	1946	1973	-	Apr	lastSun	2:00	1:00	D
--- 951,968 ----
  Rule	Mont	1924	only	-	May	17	2:00	1:00	D
  Rule	Mont	1924	1926	-	Sep	lastSun	2:30	0	S
  Rule	Mont	1925	1926	-	May	Sun>=1	2:00	1:00	D
! # The 1927-to-1937 rules can be expressed more simply as
! # Rule	Mont	1927	1937	-	Apr	lastSat	24:00	1:00
D
! # Rule	Mont	1927	1937	-	Sep	lastSat	24:00	0
S
! # The rules below avoid use of 24:00
! # (which pre-1998 versions of zic cannot handle).
! Rule	Mont	1927	only	-	May	1	0:00	1:00	D
! Rule	Mont	1928	1931	-	Apr	lastSun	0:00	1:00	D
! Rule	Mont	1932	only	-	May	1	0:00	1:00	D
! Rule	Mont	1933	1937	-	Apr	lastSun	0:00	1:00	D
! Rule	Mont	1927	1932	-	Sep	lastSun 0:00	0	S
! Rule	Mont	1933	only	-	Oct	1	0:00	0	S
! Rule	Mont	1934	1937	-	Sep	lastSun 0:00	0	S
  Rule	Mont	1938	1940	-	Apr	lastSun	0:00	1:00	D
  Rule	Mont	1938	1939	-	Sep	lastSun	0:00	0	S
  Rule	Mont	1946	1973	-	Apr	lastSun	2:00	1:00	D
***************
*** 975,982 ****
  Rule	Toronto	1928	only	-	Apr	lastSun	2:00	1:00	D
  Rule	Toronto	1929	only	-	Apr	lastSun	0:00	1:00	D
  Rule	Toronto	1929	only	-	Sep	lastSun	0:00	0	S
! Rule	Toronto	1930	1937	-	Apr	lastSat	24:00	1:00	D
! Rule	Toronto	1930	1937	-	Sep	lastSat	24:00	0	S
  Rule	Toronto	1938	1940	-	Apr	lastSun	0:00	1:00	D
  Rule	Toronto	1938	1939	-	Sep	lastSun	0:00	0	S
  Rule	Toronto	1945	1946	-	Sep	lastSun	2:00	0	S
--- 985,1001 ----
  Rule	Toronto	1928	only	-	Apr	lastSun	2:00	1:00	D
  Rule	Toronto	1929	only	-	Apr	lastSun	0:00	1:00	D
  Rule	Toronto	1929	only	-	Sep	lastSun	0:00	0	S
! # The 1930-to-1937 rules can be expressed more simply as
! # Rule	Toronto	1930	1937	-	Apr	lastSat	24:00	1:00
D
! # Rule	Toronto	1930	1937	-	Sep	lastSat	24:00	0
S
! # The rules below avoid use of 24:00
! # (which pre-1998 versions of zic cannot handle).
! Rule	Toronto	1930	1931	-	Apr	lastSun	0:00	1:00	D
! Rule	Toronto	1932	only	-	May	1	0:00	1:00	D
! Rule	Toronto	1933	1937	-	Apr	lastSun	0:00	1:00	D
! Rule	Toronto	1930	1932	-	Sep	lastSun 0:00	0	S
! Rule	Toronto	1933	only	-	Oct	1	0:00	0	S
! Rule	Toronto	1934	1937	-	Sep	lastSun 0:00	0	S
  Rule	Toronto	1938	1940	-	Apr	lastSun	0:00	1:00	D
  Rule	Toronto	1938	1939	-	Sep	lastSun	0:00	0	S
  Rule	Toronto	1945	1946	-	Sep	lastSun	2:00	0	S

------- private.h -------
*** /tmp/geta11263	Thu Dec  4 12:00:26 2003
--- /tmp/getb11263	Thu Dec  4 12:00:26 2003
***************
*** 21,27 ****
  
  #ifndef lint
  #ifndef NOID
! static char	privatehid[] = "@(#)private.h	7.52";
  #endif /* !defined NOID */
  #endif /* !defined lint */
  
--- 21,27 ----
  
  #ifndef lint
  #ifndef NOID
! static char	privatehid[] = "@(#)private.h	7.53";
  #endif /* !defined NOID */
  #endif /* !defined lint */
  
***************
*** 288,294 ****
  #endif /* HAVE_INCOMPATIBLE_CTIME_R */
  
  /*
! ** UNIX was a registered trademark of UNIX System Laboratories in 1993.
  */
  
  #endif /* !defined PRIVATE_H */
--- 288,294 ----
  #endif /* HAVE_INCOMPATIBLE_CTIME_R */
  
  /*
! ** UNIX was a registered trademark of The Open Group in 2003.
  */
  
  #endif /* !defined PRIVATE_H */

------- Theory -------
*** /tmp/geta11282	Thu Dec  4 12:00:26 2003
--- /tmp/getb11282	Thu Dec  4 12:00:27 2003
***************
*** 1,4 ****
! @(#)Theory	7.13
  
  
  ----- Outline -----
--- 1,4 ----
! @(#)Theory	7.14
  
  
  ----- Outline -----
***************
*** 12,18 ****
  ----- Time and date functions -----
  
  These time and date functions are upwards compatible with POSIX.1,
! an international standard for Unix-like systems.
  As of this writing, the current edition of POSIX.1 is:
  
    Information technology --Portable Operating System Interface (POSIX (R))
--- 12,18 ----
  ----- Time and date functions -----
  
  These time and date functions are upwards compatible with POSIX.1,
! an international standard for UNIX-like systems.
  As of this writing, the current edition of POSIX.1 is:
  
    Information technology --Portable Operating System Interface (POSIX (R))
***************
*** 144,150 ****
  	since the format of zic's input changed slightly in late 1994,
  	and many vendors still do not support the new input format.
  
! *	The Unix Version 7 "timezone" function is not present in this
package;
  	it's impossible to reliably map timezone's arguments (a "minutes
west
  	of GMT" value and a "daylight saving time in effect" flag) to a
  	time zone abbreviation, and we refuse to guess.
--- 144,150 ----
  	since the format of zic's input changed slightly in late 1994,
  	and many vendors still do not support the new input format.
  
! *	The UNIX Version 7 "timezone" function is not present in this
package;
  	it's impossible to reliably map timezone's arguments (a "minutes
west
  	of GMT" value and a "daylight saving time in effect" flag) to a
  	time zone abbreviation, and we refuse to guess.

------- workman.sh -------
*** /tmp/geta11301	Thu Dec  4 12:00:27 2003
--- /tmp/getb11301	Thu Dec  4 12:00:27 2003
***************
*** 0 ****
--- 1,29 ----
+ #! /bin/sh
+ 
+ # @(#)workman.sh	1.7
+ 
+ # Tell groff not to emit SGR escape sequences (ANSI color escapes).
+ GROFF_NO_SGR=1
+ export GROFF_NO_SGR
+ 
+ echo ".am TH
+ .hy 0
+ .na
+ ..
+ .rm }H
+ .rm }F" | nroff -man - ${1+"$@"} | perl -ne '
+ 	chomp;
+ 	s/.\010//g;
+ 	s/\s*$//;
+ 	if (/^$/) {
+ 		$sawblank = 1;
+ 		next;
+ 	} else {
+ 		if ($sawblank && $didprint) {
+ 			print "\n";
+ 			$sawblank = 0;
+ 		}
+ 		print "$_\n";
+ 		$didprint = 1;
+ 	}
+ ' 

------- zic.c -------
*** /tmp/geta11320	Thu Dec  4 12:00:27 2003
--- /tmp/getb11320	Thu Dec  4 12:00:27 2003
***************
*** 1,4 ****
! static char	elsieid[] = "@(#)zic.c	7.113";
  
  #include "private.h"
  #include "locale.h"
--- 1,4 ----
! static char	elsieid[] = "@(#)zic.c	7.115";
  
  #include "private.h"
  #include "locale.h"
***************
*** 931,936 ****
--- 931,938 ----
  			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));
***************
*** 2230,2234 ****
  }
  
  /*
! ** UNIX was a registered trademark of UNIX System Laboratories in 1993.
  */
--- 2232,2236 ----
  }
  
  /*
! ** UNIX was a registered trademark of The Open Group in 2003.
  */

------- zic.8 -------
*** /tmp/geta11429	Thu Dec  4 12:11:14 2003
--- /tmp/getb11429	Thu Dec  4 12:11:14 2003
***************
*** 81,86 ****
--- 81,89 ----
  of years representable by
  .IR time (2)
  values.
+ Also complain if a time of 24:00
+ (which cannot be handled by pre-1998 versions of zic)
+ appears in the input.
  .TP
  .B \-s
  Limit time values stored in output files to values that are the same
***************
*** 417,420 ****
  /usr/local/etc/zoneinfo	standard directory used for created files
  .SH "SEE ALSO"
  newctime(3), tzfile(5), zdump(8)
! .\" @(#)zic.8	7.20
--- 420,423 ----
  /usr/local/etc/zoneinfo	standard directory used for created files
  .SH "SEE ALSO"
  newctime(3), tzfile(5), zdump(8)
! .\" @(#)zic.8	7.21



More information about the tz mailing list