On Nov 13, 2024, at 2:58 PM, Johnny Billquist
<bqt(a)softjar.se> wrote:
Well. Bad design is not the same as "bug" either. ;-)
It is to me, and I worked in that group.
I would suspect the author had some reason (good or
bad) for defining it the way it was.
I think extending it to unsigned 16 bits is a very straight forward and obvious way to
fix this.
But to be honest, I think the whole format is completely broken to begin with. Either
just specify it as seconds (or days) after some epoch, or have separate fields for each
component. Julian half-days? Who on earth came up with that idea?
The formula is just horrific:
JULIAN =
(3055*(MONTH+2)/1OO-(MONTH+10)/13*2-91+(1-(YEAR-YEAR/4*4+3)/4)*(MONTH+10)/13+DAY-1+(YEAR-1977)*365+(YEAR-1977)/4)*2
It probably comes from a desire to do things with 16 bit elements.
That formula looks painful because the Julian/Gregorian calendar is. The definition of
the value is simply days since epoch, times two plus 1 if it's afternoon. The point
of half-days is to fit the time of day (in seconds) in 16 bits rather than 17.
RT-11 does it vaguely like this: days since epoch and time in seconds, but the difference
is that they do use whole days and 17 bit time.
paul