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

M.-A. Lemburg mal@lemburg.com
Sat, 09 Feb 2002 12:40:27 +0100


[You should never post HTML email to mailing lists...]

Stephan Richter wrote:
> 
> Hello everyone,
> 
> what a coincidence. I just was discussing this issue with Jason O.
> today. Here is my original mail:
> 
> Hey Jason,
> 
> I also want to start to think about a DateTime module. PostGres has a
> nice discussion of their impementation:
> http://www.ca.postgresql.org/users-lounge/docs/7.1/user/datatype-datetime.html
> 
> Here is Java's stuff on it:
> http://www3.cbu.edu/sciences/jdk1.3/docs/api/java/sql/Date.html
> 
> Low Level Data Types:
> 
> Date
> Time
> DateTime
> TimeStamp - Timestamps are always in UTC.

See below... you don't need that many types.
 
> * Intervals can be added or subtracted from themselves and the types
> above.
> DateInterval
> TimeInterval
> DateTimeInterval
> TimeStampInterval

Intervals are a bad idea. 

You really only need two types: one referencing fixed points in 
time and another one for storing the delta between two such 
fixed points. Everything else can be modeled on top of those
two.

Please have a look at mxDateTime. It has these two types and
much of what you described in your notes.

BTW, you wouldn't believe how complicated dealing with date
and time really is... ah, yes, and don't even think of ever
getting DST to work properly :-/ 

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/