proposed time zone package changes (Mercer ND, Indonesian names, date.c overflow-proofing)

Arthur David Olson olsona at lecserver.nci.nih.gov
Thu Jan 27 00:22:27 UTC 2011


Here are proposed changes to the time zone package; the executive summary:

* date.c	Replace "comptm" with "sametm" to avoid potential overflow
		(with code simplification as a side effect).
* northamerica	Add America/North_Dakota/Beulah (Mercer County, North Dakota,
		moved from Mountain to Central time at end of DST in 2010);
		use actual version number rather than "%W%".
* zone.tab	Add America/North_Dakota/Beulah (Mercer County, North Dakota,
		moved from Mountain to Central time at end of DST in 2010);
		update Indonesian location names (with old names retained in
		parentheses).

The update to "northamerica" does affect current time stamps.

There's more overflow work to do; the date.c work above is just the
low-hanging fruit.

For Indonesian locations I referred to...
	https://www.cia.gov/library/publications/the-world-factbook/graphics/ref_maps/pdf/asia.pdf
...and...
	https://www.cia.gov/library/publications/the-world-factbook/graphics/ref_maps/pdf/oceania.pdf
...but note that the island labeled "Sulawesi (Celebes)" in "asia.pdf" is
labeled "Celebes" in "oceania.pdf". (This paragraph may serves to
notify the CIA of the problem:-)

Also, the map at...
	http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=maluku&aq=&sll=37.0625,-95.677068&sspn=32.527387,86.396484&ie=UTF8&hq=&hnear=Maluku&z=6
...shows islands labeled "Maluku" and "Maluku Utara" and a sea labeled
"Molucca Sea."

If no problems are found, I'll update the ftp site on 2011-02-07.

				--ado

diff -r -c old/date.c new/date.c
*** old/date.c	Thu Dec 16 12:24:43 2010
--- new/date.c	Tue Jan 25 16:12:48 2011
***************
*** 1,6 ****
  #ifndef lint
  #ifndef NOID
! static char	elsieid[] = "@(#)date.c	8.4";
  /*
  ** Modified from the UCB version with the SCCS ID appearing below.
  */
--- 1,6 ----
  #ifndef lint
  #ifndef NOID
! static char	elsieid[] = "@(#)date.c	8.5";
  /*
  ** Modified from the UCB version with the SCCS ID appearing below.
  */
***************
*** 76,82 ****
  static int		retval = EXIT_SUCCESS;
  
  static void		checkfinal(const char *, int, time_t, time_t);
- static int		comptm(const struct tm *, const struct tm *);
  static time_t		convert(const char *, int, time_t);
  static void		display(const char *);
  static void		dogmt(void);
--- 76,81 ----
***************
*** 86,91 ****
--- 85,91 ----
  static const char *	nondigit(const char *);
  static void		oops(const char *);
  static void		reset(time_t, int);
+ static int		sametm(const struct tm *, const struct tm *);
  static void		timeout(FILE *, const char *, const struct tm *);
  static void		usage(void);
  static void		wildinput(const char *, const char *,
***************
*** 594,612 ****
  }
  
  static int
! comptm(atmp, btmp)
  register const struct tm * const atmp;
  register const struct tm * const btmp;
  {
! 	register int	result;
! 
! 	if ((result = (atmp->tm_year - btmp->tm_year)) == 0 &&
! 		(result = (atmp->tm_mon - btmp->tm_mon)) == 0 &&
! 		(result = (atmp->tm_mday - btmp->tm_mday)) == 0 &&
! 		(result = (atmp->tm_hour - btmp->tm_hour)) == 0 &&
! 		(result = (atmp->tm_min - btmp->tm_min)) == 0)
! 			result = atmp->tm_sec - btmp->tm_sec;
! 	return result;
  }
  
  /*
--- 594,609 ----
  }
  
  static int
! sametm(atmp, btmp)
  register const struct tm * const atmp;
  register const struct tm * const btmp;
  {
! 	return atmp->tm_year == btmp->tm_year &&
! 		atmp->tm_mon == btmp->tm_mon &&
! 		atmp->tm_mday == btmp->tm_mday &&
! 		atmp->tm_hour == btmp->tm_hour &&
! 		atmp->tm_min == btmp->tm_min &&
! 		atmp->tm_sec == btmp->tm_sec;
  }
  
  /*
***************
*** 708,714 ****
  	tm.tm_isdst = -1;
  	outtm = tm;
  	outt = mktime(&outtm);
! 	return (comptm(&tm, &outtm) == 0) ? outt : -1;
  }
  
  /*
--- 705,711 ----
  	tm.tm_isdst = -1;
  	outtm = tm;
  	outt = mktime(&outtm);
! 	return sametm(&tm, &outtm) ? outt : -1;
  }
  
  /*
***************
*** 746,752 ****
  	othertm.tm_isdst = !tm.tm_isdst;
  	othert = mktime(&othertm);
  	if (othert != -1 && othertm.tm_isdst != tm.tm_isdst &&
! 		comptm(&tm, &othertm) == 0)
  			iffy(t, othert, value,
  			    _("both standard and summer time versions exist"));
  /*
--- 743,749 ----
  	othertm.tm_isdst = !tm.tm_isdst;
  	othert = mktime(&othertm);
  	if (othert != -1 && othertm.tm_isdst != tm.tm_isdst &&
! 		sametm(&tm, &othertm))
  			iffy(t, othert, value,
  			    _("both standard and summer time versions exist"));
  /*
***************
*** 776,782 ****
  				othert = t + 60 * offset;
  			else	othert = t - 60 * offset;
  			othertm = *localtime(&othert);
! 			if (comptm(&tm, &othertm) == 0)
  				iffy(t, othert, value,
  					_("multiple matching times exist"));
  		}
--- 773,779 ----
  				othert = t + 60 * offset;
  			else	othert = t - 60 * offset;
  			othertm = *localtime(&othert);
! 			if (sametm(&tm, &othertm))
  				iffy(t, othert, value,
  					_("multiple matching times exist"));
  		}
diff -r -c old/northamerica new/northamerica
*** old/northamerica	Thu Jan 20 07:14:48 2011
--- new/northamerica	Wed Jan 26 17:13:48 2011
***************
*** 1,5 ****
  # <pre>
! # %W%
  # This file is in the public domain, so clarified as of
  # 2009-05-17 by Arthur David Olson.
  
--- 1,5 ----
  # <pre>
! # @(#)northamerica	8.40
  # This file is in the public domain, so clarified as of
  # 2009-05-17 by Arthur David Olson.
  
***************
*** 346,351 ****
--- 346,372 ----
  			-7:00	US	M%sT	2003 Oct 26 02:00
  			-6:00	US	C%sT
  
+ # From Josh Findley (2011-01-21):
+ # ...it appears that Mercer County, North Dakota, changed from the
+ # mountain time zone to the central time zone at the last transition from
+ # daylight-saving to standard time (on Nov. 7, 2010):
+ # <a href="http://www.gpo.gov/fdsys/pkg/FR-2010-09-29/html/2010-24376.htm">
+ # http://www.gpo.gov/fdsys/pkg/FR-2010-09-29/html/2010-24376.htm
+ # </a>
+ # <a href="http://www.bismarcktribune.com/news/local/article_1eb1b588-c758-11df-b472-001cc4c03286.html">
+ # http://www.bismarcktribune.com/news/local/article_1eb1b588-c758-11df-b472-001cc4c03286.html
+ # </a>
+ 
+ # From Andy Lipscomb (2011-01-24):
+ # ...according to the Census Bureau, the largest city is Beulah (although
+ # it's commonly referred to as Beulah-Hazen, with Hazen being the next
+ # largest city in Mercer County).  Google Maps places Beulah's city hall
+ # at 4715'51" north, 10146'40" west, which yields an offset of 6h47'07".
+ 
+ Zone America/North_Dakota/Beulah -6:47:07 - LMT 1883 Nov 18 12:12:53
+ 			-7:00	US	M%sT	2010 Nov  7 2:00
+ 			-6:00	US	C%sT
+ 
  # US mountain time, represented by Denver
  #
  # Colorado, far western Kansas, Montana, western
diff -r -c old/zone.tab new/zone.tab
*** old/zone.tab	Thu Dec 16 12:24:20 2010
--- new/zone.tab	Wed Jan 26 18:47:09 2011
***************
*** 1,5 ****
  # <pre>
! # @(#)zone.tab	8.38
  # This file is in the public domain, so clarified as of
  # 2009-05-17 by Arthur David Olson.
  #
--- 1,5 ----
  # <pre>
! # @(#)zone.tab	8.40
  # This file is in the public domain, so clarified as of
  # 2009-05-17 by Arthur David Olson.
  #
***************
*** 211,218 ****
  HU	+4730+01905	Europe/Budapest
  ID	-0610+10648	Asia/Jakarta	Java & Sumatra
  ID	-0002+10920	Asia/Pontianak	west & central Borneo
! ID	-0507+11924	Asia/Makassar	east & south Borneo, Celebes, Bali, Nusa Tengarra, west Timor
! ID	-0232+14042	Asia/Jayapura	Irian Jaya & the Moluccas
  IE	+5320-00615	Europe/Dublin
  IL	+3146+03514	Asia/Jerusalem
  IM	+5409-00428	Europe/Isle_of_Man
--- 211,218 ----
  HU	+4730+01905	Europe/Budapest
  ID	-0610+10648	Asia/Jakarta	Java & Sumatra
  ID	-0002+10920	Asia/Pontianak	west & central Borneo
! ID	-0507+11924	Asia/Makassar	east & south Borneo, Sulawesi (Celebes), Bali, Nusa Tengarra, west Timor
! ID	-0232+14042	Asia/Jayapura	west New Guinea (Irian Jaya) & Malukus (Moluccas)
  IE	+5320-00615	Europe/Dublin
  IL	+3146+03514	Asia/Jerusalem
  IM	+5409-00428	Europe/Isle_of_Man
***************
*** 404,409 ****
--- 404,410 ----
  US	+450628-0873651	America/Menominee	Central Time - Michigan - Dickinson, Gogebic, Iron & Menominee Counties
  US	+470659-1011757	America/North_Dakota/Center	Central Time - North Dakota - Oliver County
  US	+465042-1012439	America/North_Dakota/New_Salem	Central Time - North Dakota - Morton County (except Mandan area)
+ US	+471551-1014640	America/North_Dakota/Beulah	Central Time - North Dakota - Mercer County
  US	+394421-1045903	America/Denver	Mountain Time
  US	+433649-1161209	America/Boise	Mountain Time - south Idaho & east Oregon
  US	+364708-1084111	America/Shiprock	Mountain Time - Navajo



More information about the tz mailing list