[Python-Dev] proposal: add basic time type to the standard library (original) (raw)

Jeremy Hylton jeremy@alum.mit.edu
Thu, 7 Feb 2002 20:04:23 -0500


"TP" == Tim Peters <tim.one@comcast.net> writes:

TP> [Guido]

I'm notoriously bad at channeling Jim. Nevertheless, I do recall him saying he wanted a lightweight time object.

TP> Given that most mallocs align to 8-byte boundaries these days TP> (also true of pymalloc), it's impossible in reality to define a TP> smaller object than TimeStamp, provided it needs at least one TP> byte of info beyond PyObject_HEAD.

Also, it may not be necessary to have a TimeStamp object in ZODB 4. There are three uses for the timestamp: tracking how recently an object was used for cache evication, providing a last modified time to users, and as a simple version number.

In ZODB 4, the cache eviction may be done quite differently. The version number may be a simple int. The last mod time will not be provided for each object; instead, users will need to define this themselves if they care about it. If they define it themselves, they'd probably use a DateTime object, but we'd care much less about how small it is.

Jeremy