[7479] in SIPB bug reports

home help back first fref pref prev next nref lref last post

Re: rn bug

daemon@ATHENA.MIT.EDU (John Carr)
Sun Jan 16 16:29:04 2000

Message-Id: <200001162127.QAA17901@mint-square.mit.edu>
To: John Hawkinson <jhawk@MIT.EDU>
Cc: bug-sipb@MIT.EDU
In-Reply-To: Your message of "Sun, 16 Jan 2000 16:06:17 EST."
             <200001162106.QAA25731@x15-cruise-basselope.mit.edu> 
Date: Sun, 16 Jan 2000 16:27:44 -0500
From: John Carr <jfc@MIT.EDU>


That patch does not fix the bug and I'm not sure why.  I had intended
to build an rn with the following patch, but I did not want to guess
at the proper configuration options and now I doubt that it would help
either.

I wonder if mktime might be a more appropriate tool.

*** parsedate.y.orig	Tue Jan 17 14:24:09 1995
--- parsedate.y	Wed Jan 12 08:51:05 2000
***************
*** 486,495 ****
      static int	DaysLeap[13] = {
  	0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
      };
-     static int	LeapYears[] = {
- 	1972, 1976, 1980, 1984, 1988, 1992, 1996,
- 	2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028, 2032, 2036
-     };
      register int	*yp;
      register int	*mp;
      register time_t	Julian;
--- 486,491 ----
***************
*** 498,512 ****
  
      if (Year < 0)
  	Year = -Year;
      if (Year < 100)
  	Year += 1900;
      if (Year < EPOCH)
  	Year += 100;
!     for (mp = DaysNormal, yp = LeapYears; yp < ENDOF(LeapYears); yp++)
! 	if (Year == *yp) {
! 	    mp = DaysLeap;
! 	    break;
! 	}
      if (Year < EPOCH || Year > END_OF_TIME
       || Month < 1 || Month > 12
       /* NOSTRICT *//* conversion from long may lose accuracy */
--- 494,509 ----
  
      if (Year < 0)
  	Year = -Year;
+     Year += 1900;
+ #if 0
      if (Year < 100)
  	Year += 1900;
      if (Year < EPOCH)
  	Year += 100;
! #endif
!     /* Every year supported by this program that is divisible by 4 is
!        a leap year.  */
!     mp = Year % 4 ? DaysNormal : DaysLeap;
      if (Year < EPOCH || Year > END_OF_TIME
       || Month < 1 || Month > 12
       /* NOSTRICT *//* conversion from long may lose accuracy */
***************
*** 514,522 ****
  	return -1;
  
      Julian = Day - 1 + (Year - EPOCH) * 365;
!     for (yp = LeapYears; yp < ENDOF(LeapYears); yp++, Julian++)
! 	if (Year <= *yp)
! 	    break;
      for (i = 1; i < Month; i++)
  	Julian += *++mp;
      Julian *= SECSPERDAY;
--- 511,519 ----
  	return -1;
  
      Julian = Day - 1 + (Year - EPOCH) * 365;
!     /* Add one day per leap year since the epoch, not including the
!        current year. */
!     Julian += (Year - 1) / 4 - EPOCH / 4;
      for (i = 1; i < Month; i++)
  	Julian += *++mp;
      Julian *= SECSPERDAY;

home help back first fref pref prev next nref lref last post