On Sat, 11 Jan 2003 16:44:37 -0500 (EST), [EMAIL PROTECTED] wrote: >On Sat, 11 Jan 2003, Dave Rolsky wrote: > >> You know, on reflection, I don't think the internals matter _at all_ >> (well, they need to work, but you already took care of that ;) What >> matters is that we can return a _standard_ value for the use of other >> calendar implementers. > >Yes, that is the conclusion that we came to. Indeed, we changed the >internals at least twice, with no change to the API.
Date::ICal uses what Calendrical Calculations uses (that they call Rata Die, fixed date). They are days on or after Jan 1 of year 1 (Gregorian). This different from MJD. I'd like to see Date::ICal switch to using rd to describe them instead of jd in some places and julian in others. The greg2jd and jd2greg functions should work for any R.D. between minint and maxint inclusive. This gives a range of 11.75+ million years with 32 bit ints and 50 quadrillion years with 64 bit ints. The only other function that really needs to access the internal format is day_of_week. greg2jd is also supposed to return correctly normalized results for any integer values given (e.g. with year -12000000, month 1, and day 2000000001, you should get the R.D. 2 billion days after the start of year -12000000.). The subs greg2jd and jd2greg and the tests in 09greg.t are are in the public domain. They are based on ideas from the first edition of Calendrical Calculations (especially the Cycles of Years section) but use no actual algorithms from it (which may be under copyright and/or patent protection--though I think Rich Bowen does have an arrangement with the authors for some of his work.) They do resemble the alternate Gregorian functions in the second edition.