[comp.os.minix] V1.3 posting #13 - cron.c, ctime.c, and date.diff

hall@nosc.NOSC.MIL (Robert R. Hall) (06/10/88)

Try setting the date to 31 dec 1988 any hour:
and see what you end up with.

I had tried to sent this patch for date before and it appears
to be ignored!  however I will try one more time.
This diff is relative AST posting #13 of V1.3


-----------------------   date.dif   ------------------------------
5c5
< int qflag;
---
> int qflag = 0;
58a59,60
>   long t_inc;
> 
65,67c67,70
<   while (t >= s_p_year) {
< 	if (((tm.year + 2) % 4) == 0)
< 		t -= s_p_day;
---
>   t_inc = s_p_year;
>   if (((tm.year + 2) % 4) == 0)
> 	t_inc += s_p_day;
>   while (t >= t_inc) {
69c72,75
< 	t -= s_p_year;
---
> 	t -= t_inc;
> 	t_inc = s_p_year;
> 	if (((tm.year + 2) % 4) == 0)
> 		t_inc += s_p_day;
71,72d76
<   if (((tm.year + 2) % 4) == 0)
< 	days_per_month[1] = 29;
73a78
>   days_per_month[1] = ((tm.year % 4) == 0) ? 29 : 28;
100d104
<   tm.year -= 1970;
113c117
<   	tm.year = conv(&tp, 99);
---
>   	tm.year = conv(&tp, 99) + 1900;
116,118d119
<   	tm.year -= 70;
< 	if (tm.year < 0)
< 		tm.year += 100;
119a121,124
>   days_per_month[1] = ((tm.year % 4) == 0) ? 29 : 28;
>   tm.year -= 1970;
>   if (tm.year < 0)
> 	  tm.year += 100;
122,123d126
<   if (((tm.year + 2) % 4) == 0)
< 	days_per_month[1] = 29;
132,133d134
<   if (days_per_month[1] > 28)
< 	days_per_month[1] = 28;

------------------------------------------------------------------
				     Robert R. Hall
				     hall@nosc.mil