Re: Date arithmetic and Zune bug



H. Peter Anvin <hpa@xxxxxxxxx> wrote:
+---------------
| One important bit about anything dealing with Gregorian dates is the
| observation Christian Zeller did well over a century ago: the math gets
| a lot cleaner if you treat January and February as months 13 and 14 of
| (year-1). March was, in fact, historically the first month, as
| evidenced by our names for months 9 to 12: "September" ("seventh month")
| to "December" ("tenth month")...
+---------------

Eric Naggum's classic paper on the subject [known mostly among the Lisp
community, but applicable & readily accessible to a general audience]:

http://naggum.no/lugm-time.html
The Long, Painful History of Time
Erik Naggum, Naggum Software
Oslo, Norway
1999-10-11

suggests doing something very similar:

...
The Roman tradition of starting the year in the month of March
has also been lost. Most agrarian societies were far more
interested in the onset of spring than in the winter solstice,
even though various deities were naturally celebrated when the
sun returned. ...but Julius Caesar decided to move the Roman
calendar back two months... far more important was the decision
to retain the leap day in February. In the old calendar, the
leap day was added at the end of the year, as makes perfect
sense, when the month was already short, but now it is squeezed
into the middle of the first quarter, complicating all sorts of
calculations, and affecting how much people work. In the old
days, the leap day was used as an extra day for the various
fertility festivities.

[If one starts the year on March 1st] the simplicity of the scheme
is quite amazing: a 400-year cycle not only starts 2000-03-01
(as it did 1600-03-01), it contains an even number of weeks: 20,871.
This means that we can make do with a single 400-year calculation
for all time within the Gregorian calendar with respect to days of
week, leap days, etc.
...
The LOCAL-TIME Concept
...
Because we are [in 1999] very close to the beginning of the next
400-year leap-year cycle, thanks to Pope Gregory, day 0 is defined
to be 2000-03-01, which much less arbitrary than other systems,
but not obviously so. Each 400-year cycle contains 146,097 days,
so an arbitrary decision was made to limit the day to a maximal
negative value of -146,097, or 1600-03-01. This can be changed
at the peril of accurately representing days that do not belong
to the calendar used at the time.
...
[Because bignum arithmetic is expensive] The LOCAL-TIME concept
therefore represents time as three disjoint fixnums [relatively
small tagged integers that consume only one machine word, including
a few bits of type tag]:

1. the number of days since (or until, when negative) 2000-03-01
2. the number of seconds since the start of the day in
Coordinated Universal Time
3. the number of milliseconds since the start of the second.

All numbers have origin 0. Only the number of days may be negative.
...[more details about why this makes sense, how conversions and
date/time calculations (including intervals) are done in the system]...

Note: Even if you don't care for his proposed system, the paper is
a delightful tour of calendric history which touches on the influences
of geography, politics, science, and general historical randomness. ;-}


-Rob

-----
Rob Warnock <rpw3@xxxxxxxx>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607


.



Relevant Pages

  • Re: It it now a leap year?
    ... even showing that the rules defined for leap ... Julian or Gregorian? ... Didn't Pope Gregory fixed the calendar, ...
    (Fedora)
  • [OT] Re: Calendar fun
    ... > four years to correct for the fact that Earth's solar year is slightly more ... > leap years should not occur in years ending in '00', ... > A modern estimate of a calendar year is 365.24219 rotations of Earth per ... try correcting the Gregorian, rather than the Julian. ...
    (comp.lang.java)
  • Re: Todays Factoid 7.2-Steve
    ... Calendar"), but was not invented by him. ... A year divisible by 100 is not a leap year except... ... all the protestant ... countries saw sense and switched to the Gregorian calendar. ...
    (alt.support.stop-smoking)
  • Re: Todays Factoid 7.2
    ... The changed was order by Pope Gregory (hence "Gregorian ... Calendar"), but was not invented by him. ... A year divisible by 100 is not a leap year except... ... all the protestant countries ...
    (alt.support.stop-smoking)
  • Re: Venus origin of China and Japans, p5
    ... 2947 BC NeoBabylon says is Flood +740 years 185 leap days to kingship ... The real synodic Venus loses an ... 121 years and 8 months in Noah's calendar. ...
    (talk.origins)