[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: y2000 for the gs
Frank Carney <frankcNOSPAM@cyberhighway.net> wrote:
> I also have been wondering about the IIgs clock functions. The control
> panel seems to report years in 2-digit format. How does the IIgs keep
> track of years internally?
The clock hardware itself is the same as the Mac: it stores a 32-bit
value, which is the number of seconds since 1st January 1904. This
format is hidden entirely within the firmware/toolbox, except for one
toolbox call that was added around System 5.0 to convert between time
formats. Everything else accesses the clock via a packed BCD format or
as text. For the packed BCD format, the year is provided as a two digit
number.
The sequence of dates returned by the clock calls are 99, 00, 01, ...
In theory, the clock will run out of seconds around 2040 and wrap around
to 1904.
The next question is what the operating system does with it. ProDOS-8
has a two-byte date field that has the year, month and day packed into
7-bit, 4-bit and 5-bit fields respectively. GS/OS doesn't provide
direct access to the clock (leaving it for the toolbox), but in file
system calls it deals with it in the same format as the clock calls,
i.e. a 2-digit BCD number for the year.
In theory, ProDOS-8's year could count past 99 to 100 and on as far as
127. It does not do this, however: it should only contain values from 0
to 99.
Around 1991, Apple specified how the year was supposed to behave for the
Apple II. The rule is that the two-digit year is to be interpreted in
two bands: 40-99 are 1940-1999, and 00-39 are 2000-2039.
It is then the responsibility of applications to handle this definition,
e.g. in cases where dates are displayed in full, or where dates are
compared.
--
David Empson
dempson@actrix.gen.nz
Snail mail: P.O. Box 27-103, Wellington, New Zealand