Kwajalein bug fix

Arthur David Olson ado
Sat Aug 28 16:36:44 UTC 1993


Thanks to Paul Eggert for the Kwajalein changes.  My notions on how to do it
are attached.  It might be better to toss Kwajalein into australasia than to
create a new file; as I recall, some vendors might be using a "patch" scheme
that's better at handling changes than handling additions.  I also took the
opportunity while visiting zdump to eliminate the "VERY approximate" kludge
in handling zdump's "-c" option.  (Given the relentless increase in processor
power, maybe the better thing to do is eliminate the "-c" option.)

I'll wait a bit for feedback from this list; eventually folks should expect to
see tzcode93e.tar.Z and tzdata93e.tar.Z on elsie.nci.nih.gov.

				--ado

SCCS/s.australasia: 7.13 vs. 7.14
*** 7.13/australasia	Sat Aug 28 12:29:52 1993
--- 7.14/australasia	Sat Aug 28 12:29:52 1993
***************
*** 1,4 ****
! # @(#)australasia	7.13
  
  # Notes are at the end of this file
  
--- 1,4 ----
! # @(#)australasia	7.14
  
  # Notes are at the end of this file
  
***************
*** 105,110 ****
--- 105,118 ----
  
  ###############################################################################
  
+ # Kwajalein
+ 
+ # Zone	NAME			GMTOFF	RULES/SAVE	FORMAT	[UNTIL]
+ Zone	Kwajalein		-12:00	-		KST	1993 Aug 20
+ 				12:00	-		KST
+ 
+ ###############################################################################
+ 
  # NOTES
  
  ###############################################################################
***************
*** 431,433 ****
--- 439,451 ----
  # From Arthur David Olson (March 8, 1992):
  # The chosen rules use the Davies October 8 values for the start of DST in 1989
  # rather than the October 1 value.
+ 
+ ###############################################################################
+ 
+ # 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.
SCCS/s.zdump.c: 7.3 vs. 7.5
*** 7.3/zdump.c	Sat Aug 28 12:30:03 1993
--- 7.5/zdump.c	Sat Aug 28 12:30:03 1993
***************
*** 1,6 ****
  #ifndef lint
  #ifndef NOID
! static char	elsieid[] = "@(#)zdump.c	7.3";
  #endif /* !defined NOID */
  #endif /* !defined lint */
  
--- 1,6 ----
  #ifndef lint
  #ifndef NOID
! static char	elsieid[] = "@(#)zdump.c	7.5";
  #endif /* !defined NOID */
  #endif /* !defined lint */
  
***************
*** 39,46 ****
  #define SECSPERMIN	60
  #endif /* !defined SECSPERMIN */
  
  #ifndef SECSPERHOUR
! #define SECSPERHOUR	3600
  #endif /* !defined SECSPERHOUR */
  
  #ifndef HOURSPERDAY
--- 39,50 ----
  #define SECSPERMIN	60
  #endif /* !defined SECSPERMIN */
  
+ #ifndef MINSPERHOUR
+ #define MINSPERHOUR	60
+ #endif /* !defined MINSPERHOUR */
+ 
  #ifndef SECSPERHOUR
! #define SECSPERHOUR	(SECSPERMIN * MINSPERHOUR)
  #endif /* !defined SECSPERHOUR */
  
  #ifndef HOURSPERDAY
***************
*** 51,60 ****
--- 55,72 ----
  #define EPOCH_YEAR	1970
  #endif /* !defined EPOCH_YEAR */
  
+ #ifndef TM_YEAR_BASE
+ #define TM_YEAR_BASE	1900
+ #endif /* !defined TM_YEAR_BASE */
+ 
  #ifndef DAYSPERNYEAR
  #define DAYSPERNYEAR	365
  #endif /* !defined DAYSPERNYEAR */
  
+ #ifndef isleap
+ #define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
+ #endif /* !defined isleap */
+ 
  extern char **	environ;
  extern int	getopt();
  extern char *	optarg;
***************
*** 104,116 ****
  			argv[0], argv[0]);
  		(void) exit(EXIT_FAILURE);
  	}
! 	if (cutoff != NULL)
  		cutyear = atoi(cutoff);
! 	/*
! 	** VERY approximate.
! 	*/
! 	cuttime = (long) (cutyear - EPOCH_YEAR) *
! 		SECSPERHOUR * HOURSPERDAY * DAYSPERNYEAR;
  	(void) time(&now);
  	longest = 0;
  	for (i = optind; i < argc; ++i)
--- 116,130 ----
  			argv[0], argv[0]);
  		(void) exit(EXIT_FAILURE);
  	}
! 	if (cutoff != NULL) {
! 		int	y;
! 
  		cutyear = atoi(cutoff);
! 		cuttime = 0;
! 		for (y = EPOCH_YEAR; y < cutyear; ++y)
! 			cuttime += DAYSPERNYEAR + isleap(y);
! 		cuttime *= SECSPERHOUR * HOURSPERDAY;
! 	}
  	(void) time(&now);
  	longest = 0;
  	for (i = optind; i < argc; ++i)
***************
*** 231,243 ****
  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
--- 245,265 ----
  struct tm *	oldp;
  {
  	long	result;
+ 	int	tmy;
  
! 	if (newp->tm_year < oldp->tm_year)
! 		return -delta(oldp, newp);
! 	result = 0;
! 	for (tmy = oldp->tm_year; tmy < newp->tm_year; ++tmy)
! 		result += DAYSPERNYEAR + isleap(tmy + TM_YEAR_BASE);
! 	result += newp->tm_yday - oldp->tm_yday;
! 	result *= HOURSPERDAY;
! 	result += newp->tm_hour - oldp->tm_hour;
! 	result *= MINSPERHOUR;
! 	result += newp->tm_min - oldp->tm_min;
! 	result *= SECSPERMIN;
! 	result += newp->tm_sec - oldp->tm_sec;
! 	return result;
  }
  
  static void



More information about the tz mailing list