[Python-Dev] proposal: add basic time type to the standard library (original) (raw)
M.-A. Lemburg mal@lemburg.com
Fri, 08 Feb 2002 20:05:03 +0100
- Previous message: [Python-Dev] proposal: add basic time type to the standard library
- Next message: [Python-Dev] proposal: add basic time type to the standard library
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum wrote:
> http://effbot.org/ideas/time-type.htm > > I can produce PEP and patch if necessary. Yes, a PEP, please! Jim Fulton has been asking for this for a long time too. His main requirement is that timestamp objects are small, both in memory and as pickles, because Zope keeps a lot of these around. They are currently represented either as long ints (with a little under 64 bits) or as 8-byte strings. A dedicated timestamp object could be smaller than that. Your idea of a base type (which presumably standarizes at least one form of representation) sounds like a breakthrough that can help satisfy different other needs.
Sounds like a plan :-)
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 :-).
-- Marc-Andre Lemburg CEO eGenix.com Software GmbH
Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/
- Previous message: [Python-Dev] proposal: add basic time type to the standard library
- Next message: [Python-Dev] proposal: add basic time type to the standard library
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]