Michael,
First, I should say that I've never used DateType or any of the Date
routines. So perhaps I'm having trouble understanding your problem because
of that.
>From the Date.h header file:
// This is the date format. Dates are treated as words so don't
// change the order of the members in this structure.
//
typedef struct {
Word year :7; // years since 1904 (MAC format)
Word month :4;
Word day :5;
} DateType;
I don't understand from this how you think that the year is stored as a
"two digit value". It's clearly stored as a 7-bit value, meaning that it
can contain anything from 0 to 127 (hmmm...unsigned?). That means it can
represent the years from 1904 to 2031. This range is pretty much consistant
with the "32-bits of seconds" range that PC and Macs currently have (where
PCs range from 1/1/70 +/- 68 years (not sure about the "minus" part...),
and Macs range from 1904 to 2040).
Without knowing what you mean by "nonsense values" and "the result is
incorrect", I'm not sure if you are indeed missing anything obvious.
-- Keith Rollin
-- Palm OS Emulator engineer
"Michael P. Hutchens, MA" <[EMAIL PROTECTED]> on 04/07/99 04:34:06 AM
Please respond to [EMAIL PROTECTED]
To: Palm Developers Forum List <[EMAIL PROTECTED]>
cc: (Keith Rollin/HQ/3Com)
Subject: y2k bug inherent in DateType?
Hi,
My little program, PregCalc does a lot of date calculations. One of the
problems I've had a lot of is that the DateType only stores the year as a
two digit value (eg >2000 = >00). One major problematic result of this is
that routines like DateToDays() then return nonsense values -- eg if I
pass DateType bozo where bozo.year = 06 to DateToDays() the result
returned is incorrect. I've had a to do a lot of smoke and mirrors
programming to get around this limitation.
My question is a)am I missing something obvious, or is this really the way
things are? and b)is there a fix or is it really true that the PalmOS was
coded with this inherent y2k bug?
---------------------------------------------------------------------------
---
Michael Hutchens "There is less to this than
[EMAIL PROTECTED] meets the eye"
- Talullah Bankhead