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

Alexander Belopolsky alexander.belopolsky at gmail.com
Mon Jun 4 20:30:25 CEST 2012


On Mon, Jun 4, 2012 at 1:12 PM, Guido van Rossum <guido at python.org> wrote:
> A big +1 on making conversions between POSIX timestamps and datetime
> (with or without timezone) easier.

I am all for achieving this goal, but I think the root of the problem
is not the lack of mxDT's ticks() method.  Note that someone who
requires robust behavior across the DST change would still be puzzled
about what to supply as arguments to the .ticks(offset=0.0,dst=-1)
method.

I think the key feature that is missing from datetime is the ability
to obtain local time complete with timezone offset.  See issue 9527.
Once we have that, adding  .ticks() that requires a timezone aware
datetime instance will complete the puzzle.

The problem with adding .ticks() to naive datetime instances is the
inherent ambiguity in what such instances represent. mxDT resolves
this by offering offset and dst arguments, but this is just moving the
problem from one place to another without solving it.


More information about the Python-Dev mailing list