[Python-Dev] proposal: add basic time type to the standard library
M.-A. Lemburg
mal@lemburg.com
Fri, 08 Feb 2002 20:08:43 +0100
"M.-A. Lemburg" wrote:
>
> In order to make mxDateTime subtypes of this new type we'd need to
> make sure that the datetime type uses a true struct subset of what
> I have in DateTime objects now:
>
> typedef struct {
> PyObject_HEAD
>
> /* Representation used to do calculations */
> long absdate; /* number of days since 31.12. in the year 1 BC
> calculated in the Gregorian calendar. */
> double abstime; /* seconds since 0:00:00.00 (midnight)
> on the day pointed to by absdate */
>
> ...lots of broken down values needed to assure roundtrip safety...
>
> }
>
> Depending on the size of PyObject_HEAD, this should meet Jim
> Fultons requirements (the base type would of course not implement
> the "..." part :-).
I forgot to mention that there is another object type in mxDateTime
too: DateTimeDelta. That's the type needed to represent the time
difference between two DateTime instances, or what people usually
call "time" :-)
It has the following type "signature":
typedef struct {
PyObject_HEAD
double seconds; /* number of delta seconds */
...some broken down values needed to assure roundtrip safety...
}
--
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting: http://www.egenix.com/
Python Software: http://www.egenix.com/files/python/