[Python-Dev] proposal: add basic time type to the standard library

Paul Barrett Barrett@stsci.edu
Wed, 27 Feb 2002 14:04:40 -0500


Guido van Rossum wrote:

> 
> I think an important (but so far unvoiced) requirement is that
> datetime objects can be stored in a database.  Since the database may
> be read by systems that may or may not support leap seconds, we should
> be independent of the leap second support in the C library. As I've
> said before, we should ignore leap seconds.  Even if we end up
> expressing times deltas as a number of seconds, that should be
> understood to be calendar seconds and not astronomical seconds.  Let
> the astronomers deal with leap seconds themselves -- they should know
> how to.

As for us astronomers, we're suppose to represent time in Julian days and 
fractions thereof since the beginning of time (about 6714 years ago).  Today is 
day 2452346.  In practice we use whole days and represent the fractional part in 
seconds, because floating point numbers don't have a sufficient number of bits 
to represent Julian days to nanosecond precision.  A typical day contains 86400 
seconds.  In essence we use Julian days as our reference point and seconds of a 
day as our delta time.  From these two values you can theoretically calculate 
any time past, present, or future with or without leap seconds (if known).

Just thought you might like to know, if you didn't already.

  -- Paul

-- 
Paul Barrett, PhD      Space Telescope Science Institute
Phone: 410-338-4475    ESS/Science Software Group
FAX:   410-338-4767    Baltimore, MD 21218