timezone stuff on 64 bit machines

Arthur David Olson ado
Wed Oct 18 20:39:23 UTC 1995


If someone with a 64-bit machine could check out the attached
(and if everyone could check out the logic), I'd love it.

				--ado

SCCS/s.localtime.c: 7.45 vs. 7.46
*** 7.45/localtime.c	Wed Oct 18 16:36:18 1995
--- 7.46/localtime.c	Wed Oct 18 16:36:20 1995
***************
*** 1,6 ****
  #ifndef lint
  #ifndef NOID
! static char	elsieid[] = "@(#)localtime.c	7.45";
  #endif /* !defined NOID */
  #endif /* !defined lint */
  
--- 1,6 ----
  #ifndef lint
  #ifndef NOID
! static char	elsieid[] = "@(#)localtime.c	7.46";
  #endif /* !defined NOID */
  #endif /* !defined lint */
  
***************
*** 1173,1178 ****
--- 1173,1189 ----
  	if (tmp->tm_wday < 0)
  		tmp->tm_wday += DAYSPERWEEK;
  	y = EPOCH_YEAR;
+ #define CYCLE_DAYS	1022679L	/* Any consecutive CYCLE_DAYS days... */
+ #define CYCLE_YEARS	2800L		/* make up exactly CYCLE_YEARS years. */
+ 	if (days >= CYCLE_DAYS || days <= -CYCLE_DAYS) {
+ 		register int	cycles;
+ 
+ 		cycles = (days >= 0) ?
+ 			(days / CYCLE_DAYS) :
+ 			(-1 - (-1 - days) / CYCLE_DAYS);
+ 		days -= cycles * CYCLE_DAYS;
+ 		y += cycles * CYCLE_YEARS;
+ 	}
  	if (days >= 0)
  		for ( ; ; ) {
  			yleap = isleap(y);



More information about the tz mailing list