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

Tim Peters tim@zope.com
Thu, 28 Feb 2002 17:30:49 -0500


[Jim Fulton]

ZODB has a TimeStamp type that uses a 32-bit unsigned integer to store year, month,, day, hour, and minute in a way that makes it dirt simple to extract a component.

[Tim]

You really think so? It's a mixed-radix scheme:

v=((((y-1900)*12+mo-1)*31+d-1)*24+h)*60+m; so requires lots of expensive integer division and remainder ...

[Jim]

Compared to storing date-times as offsets from an epoch, this is much simpler and cheaper.

OK, as with most things, it boils down to the definition of dirt: you're contrasting hard-packed dirt with a 21%-dirt 79%-concrete mix, and I'm constrasting hard-packed dirt with household dust. I'm sure you'll agree that's a rigorously correct summary .