[Python-Dev] Issue 2736: datetimes and Unix timestamps

Guido van Rossum guido at python.org
Mon Jun 4 19:12:01 CEST 2012


On Mon, Jun 4, 2012 at 8:51 AM, Barry Warsaw <barry at python.org> wrote:
> On Jun 04, 2012, at 02:18 PM, Dirkjan Ochtman wrote:
>
>>Personally, I would really like not having to think about the time
>>module at all, except if I wanted to go low-level (e.g. get a Unix
>>timestamp from scratch).
>
> +1
>
> Oh and, practicality beats purity.

:-)

A big +1 on making conversions between POSIX timestamps and datetime
(with or without timezone) easier.

FWIW, I see a lot of people around me struggling with datetime objects
who would be better off using POSIX timestamps. E.g. lat week I heard
a colleague complain that he'd lost several hours trying to figure out
how to determine whether two datetimes were within 24h of each other,
getting confused by what was happening when the two were on different
sides of a DST transition (or worse, in the middle of one). This falls
under Nick's header "relative time", but the problem was that he was
trying to add this functionality to a framework that was storing
datetimes in a database, and they were previously used to record when
something had happened. He ended up having two versions of some code
-- one using timestamps, one using datetimes. Clearly that's
suboptimal.

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list