[Coco] LII.Dev.Pack "Make" works just fine! Was: MAKE_TK.lzh has a bad case of Y2K.

Michael Furman n6il at ocs.net
Mon May 30 22:00:09 EDT 2011



On May 30, 2011, at 2:53 PM, Stephen H. Fischer wrote:

> Hi,
> 
> I converted Make_TK's makefile to the LII.Dev.Pack "Make" format and it
> worked just fine as expected.
> 
> See the attachment for details.
> 
> Willard Goosey has reported different results for MAKE_TK. I just could not understand how I was causing the STACK OVERFLOW until I looked at the dates and realized that it must be a Y2K problem. It was working just fine until all the .r files had 111 dates.
> 


The Make_tk.lzh that I got from RTSI has some source and it has some really wacky date math.  Bugs aside, I think it should work correctly.

The two assumptions are:

1) Make will never encounter a year before 1980
2) The year value rolls over to 0 at the century.

Looking this over carefully it shouldn't have a Y2K problem.  Assumption 2 is false, so tpb->t_year will always be greater than 80 for any year 1980 or later.

I believe that assumption 1 is also false.  I recall seeing 1970 somewhere in the Nitros9 source as the base year. (Need Ref)

The code snippet below is from files.c in the MakeTK source.  It converts an OS-9 Date structure into seconds since 1980 and has a bug that assumes every month in each full year elapsed since 1980 has 31 days.  So it's going to be off by 4 days due to April, June, September, and November having 30 days, and 3 days for each non leap year and 2 days for leap years due to February.  So far we're at  365+4+3=372 days per year.  The farther apart the two dates being compared by this algorithm the more error there will be.

/*
 *     Kludge routine to return an aproximation of how many
 *     seconds since 1980.  Dates will be in order, but will not
 *     be linear
 */
time_t
cnvtime(tbp)
struct sgtbuf          *tbp;
{
       long                    acc;

       if (tbp->t_year > 80)
           acc = tbp->t_year - 80;         /* Baseyear is 1980 */
       else if (tbp->t_year!= 0)
           acc = tbp->t_year + 100 - 80;  /* Years <80 are in 21st cent. */
       acc = acc * 12 + tbp->t_month;
       acc = acc * 31 + tbp->t_day;
       acc = acc * 24 + tbp->t_hour;
       acc = acc * 60 + tbp->t_minute;
       acc = acc * 60 + tbp->t_second;

       return acc;
}






More information about the Coco mailing list