Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   RE: time, calendar, datetime, etc (http://www.velocityreviews.com/forums/t320464-re-time-calendar-datetime-etc.html)

 Tim Peters 08-02-2003 02:30 AM

RE: time, calendar, datetime, etc

[Andrew Dalke]
> ...
> The datetime module needs a 0 point (the creation of the universe
> being rather long ago and the exact time not well known). Given the
> questions of "when is year 0?" in different calendar systems, it's easy
> for me to understand why Jan. 1st, 1AD is a good starting point.
> (Easier than Jan 1st, 1970 - I prefered the Mac's epoch of 1900.)

There was a specific reason for picking "year 1": that makes datetime's
date ordinals identical to those used in the base proleptic Gregorian
calendar in Dershowitz and Reingold's highly regarded "Calendrical
Calculations":

http://emr.cs.iit.edu/home/reingold/...econd-edition/

So people who want umpteen kinds of calendars Guido doesn't care about can
look up algorithms in that book to do conversion to and from datetime's view
of reality. For that reason alone, it was a better choice than most. In
addition, since an explicit goal of datetime was fast extraction of fields,
we simply store the year as given (e.g., 2003 is stored as 2003). This also
works well for fast comparisons. Something missed in this discussion so far
is that commercial applications deal in countless thousands of dates and
datetimes -- formatting, sorting and indexing speed are important to them.
Important enough to Zope Corp to pay the substantial bill for developing
this code, anyway.

i-hear-guido-doesn't-come-cheap-ly y'rs - tim

 John Baxter 08-02-2003 04:32 AM

Re: time, calendar, datetime, etc

In article <mailman.1059791473.32114.python-list@python.org>,
"Tim Peters" <tim.one@comcast.net> wrote:

> [Andrew Dalke]
> > ...
> > The datetime module needs a 0 point (the creation of the universe
> > being rather long ago and the exact time not well known). Given the
> > questions of "when is year 0?" in different calendar systems, it's easy
> > for me to understand why Jan. 1st, 1AD is a good starting point.
> > (Easier than Jan 1st, 1970 - I prefered the Mac's epoch of 1900.)

1904 for Mac, actually. The story is fairly well documented, but...
It was desired to include the entire team's set of birth dates
That didn't get back to 1904, but it got reasonably close to 1900
1900 was rejected because they didn't want to start out in a leap
year exception
They did want to start in a leap year...hence 1904

The 1904 choice has meant that considered as a signed 32-bit number,
Macintosh time has always been negative. "Always" in the sense of when
there were Macintosh machines...the sign change was sometime in 1972, I
think. And since Pascal was the base higher level language, time was
indeed negative. (Macintosh time became signed 64 bits--with 32-bit
clock hardware--around 1991: plenty early to beat the End of Time early
in 2040.)

 Dennis Lee Bieber 08-03-2003 05:45 AM

RE: time, calendar, datetime, etc

Tim Peters fed this fish to the penguins on Friday 01 August 2003 07:30
pm:

> Gregorian calendar in Dershowitz and Reingold's highly regarded
> "Calendrical Calculations":
>
> http://emr.cs.iit.edu/home/reingold/...econd-edition/
>
> So people who want umpteen kinds of calendars Guido doesn't care about
> can look up algorithms in that book to do conversion to and from
> datetime's view

Pity the book uses LISP (at least, the first edition did)... Even
BASIC would be more accessible to most folks <G> (though I would prefer
a modern BASIC over G-whiz or older).

--
> ================================================== ============ <
> wlfraed@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> wulfraed@dm.net | Bestiaria Support Staff <
> ================================================== ============ <

 John Roth 08-03-2003 10:49 AM

Re: time, calendar, datetime, etc

"Dennis Lee Bieber" <wlfraed@ix.netcom.com> wrote in message
news:h9euv-4l3.ln1@beastie.ix.netcom.com...
> Tim Peters fed this fish to the penguins on Friday 01 August 2003 07:30
> pm:
>
> > Gregorian calendar in Dershowitz and Reingold's highly regarded
> > "Calendrical Calculations":
> >
> > http://emr.cs.iit.edu/home/reingold/...econd-edition/
> >
> > So people who want umpteen kinds of calendars Guido doesn't care about
> > can look up algorithms in that book to do conversion to and from
> > datetime's view

>
> Pity the book uses LISP (at least, the first edition did)... Even
> BASIC would be more accessible to most folks <G> (though I would prefer
> a modern BASIC over G-whiz or older).

That's the version I have (somewhere.) As I've said a couple of times,
it's not the lack of built-in support for all kinds of strange calendars
that's
the problem: it's the decision to limit the time span to 1AD.

John Roth
>
>
> --
> > ================================================== ============ <
> > wlfraed@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> > wulfraed@dm.net | Bestiaria Support Staff <
> > ================================================== ============ <