Kwajalein bug fix

Paul Eggert eggert at stet.twinsun.com
Thu Aug 26 21:10:09 UTC 1993


Kwajalein's missing day uncovered a bug in zdump.c, which missed the 24-hour
jump ahead because the jump was masked by the HOURSPERDAY hack in the `delta'
function.  Here's a patch, plus a proposed new `pacific' file for islands in
the Pacific.  I've made up the abbreviation `KST'; I don't know what
abbreviation Kwajaleinians really use.

I don't know when Kwajalein originally started using -12:00 -- it must have
been soon after WW II.

*** /dev/null	Fri Aug 27 07:48:01 1993
--- pacific	Fri Aug 27 07:38:41 1993
***************
*** 0 ****
--- 1,14 ----
+ # @(#)pacific
+ 
+ 
+ # Kwajalein
+ 
+ # In comp.risks 14.87 (26 August 1993), Peter Neumann writes:
+ # I wonder what happened in Kwajalein, where there was NO Friday,
+ # August 20, 1993.  Thursday night at midnight Kwajalein switched sides with
+ # respect to the International Date Line, to rejoin its fellow islands,
+ # going from 11:59 p.m. Thursday to 12:00 m. Saturday in a blink.
+ 
+ # Zone	NAME		GMTOFF	RULES/SAVE	FORMAT	[UNTIL]
+ Zone	Kwajalein	-12:00	-		KST	1993 Aug 20
+ 			12:00	-		KST
===================================================================
RCS file: zdump.c,v
retrieving revision 7.3
retrieving revision 7.3.1.1
diff -c -r7.3 -r7.3.1.1
*** zdump.c	1993/01/08 12:00:38	7.3
--- zdump.c	1993/08/26 21:08:10	7.3.1.1
***************
*** 55,60 ****
--- 55,64 ----
  #define DAYSPERNYEAR	365
  #endif /* !defined DAYSPERNYEAR */
  
+ #ifndef TM_YEAR_BASE
+ #define TM_YEAR_BASE	1900
+ #endif
+ 
  extern char **	environ;
  extern int	getopt();
  extern char *	optarg;
***************
*** 230,243 ****
  struct tm *	newp;
  struct tm *	oldp;
  {
! 	long	result;
! 
! 	result = newp->tm_hour - oldp->tm_hour;
! 	if (result < 0)
! 		result += HOURSPERDAY;
! 	result *= SECSPERHOUR;
! 	result += (newp->tm_min - oldp->tm_min) * SECSPERMIN;
! 	return result + newp->tm_sec - oldp->tm_sec;
  }
  
  static void
--- 234,256 ----
  struct tm *	newp;
  struct tm *	oldp;
  {
! 	int newy = newp->tm_year + (TM_YEAR_BASE - 1);
! 	int oldy = oldp->tm_year + (TM_YEAR_BASE - 1);
! 	return
! 		(
! 			(
! 				(
! 					/* difference in day of year */
! 					   newp->tm_yday - oldp->tm_yday
! 					/* + intervening leap days */
! 					+  (newy/4 - oldy/4)
! 					-  (newy/100 - oldy/100)
! 					+  (newy/400 - oldy/400)
! 					/* + difference in years * 365 */
! 					+  (long)(newy-oldy) * 365
! 				)*24 + (newp->tm_hour - oldp->tm_hour)
! 			)*60 + (newp->tm_min - oldp->tm_min)
! 		)*60 + (newp->tm_sec - oldp->tm_sec);
  }
  
  static void



More information about the tz mailing list