# Re: Some of Ron's Code?

Bruce O'Neel wrote:
Ken Tilton <kentilton@xxxxxxxxx> writes:

<snip>

...they fly across month boundaries (I am guessing, but I would die
laughing if it turns out they actually avoid that, too) and apparently
are doing /some/ calculations that will break by crossing a year
boundary, so it seems like they know about going from 28, 29, 30, and
31 to 1 so a year rollover (if (month==12)...) -- what? another three
lines of code?

A lot of these sorts of calculations in the ESA ground station world
are YYYYDDD, ie, year and day of year.

Yes, with the benefit of a night's sleep I am able to notice:

"On Jan. 1, 2007, the computer will think it is the 366th day of 2006."

So the code days:

++day;

if (day == (365 + (mod(year,4)==0))) {
++year;
day = 1;
} else ++day;

Sh*t, they could hardcode the leap leap year.

kt

--
Algebra: http://www.tilton-technology.com/LispNycAlgebra1.htm

"Well, I've wrestled with reality for thirty-five
years, Doctor, and I'm happy to state I finally
won out over it." -- Elwood P. Dowd

"I'll say I'm losing my grip, and it feels terrific."
-- Smiling husband to scowling wife, New Yorker cartoon
.