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

gene heskett gheskett at wdtv.com
Mon May 30 22:43:15 EDT 2011


On Monday, May 30, 2011 10:35:38 PM Michael Furman did opine:

> 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;
> }

That seems rather odd, since I recall the proper year handling for leap 
years, all of them, is generally public knowledge as it is in both of the 
K&R C books as a piece of example c code.

I recall in about 1978 or so, doing some experimenting with the 29.97 
frames/sec of NTSC as the time base, and developing a routine that ran on 
the RCA 1802 that was as accurate, leap years and all, as the rhubidium std 
that drove most of the old analog tv sync generators.  Fraction of a 
second/year typical.  

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
<http://tinyurl.com/ddg5bz>
<http://www.cantrip.org/gatto.html>
<Elric> no BSD fans ?
<EvilTypeGuy> Elric: it's hard to be a gamer and a bsd fan :p



More information about the Coco mailing list