[Python-Dev] Issue 2736: datetimes and Unix timestamps
Victor Stinner
victor.stinner at gmail.com
Mon Jun 4 21:27:17 CEST 2012
> Anyway, I was pointed to issue 2736, which seems to have got a lot of
> discouraged core contributors (Victor, Antoine, David and Ka-Ping, to
> name just a few) up against Alexander (the datetime maintainer,
> AFAIK). It seems like a fairly straightforward case of practicality
> over purity: Alexander argues that there are "easy" one-liners to do
> things like datetime.totimestamp(), but most other people seem to not
> find them so easy.
Does mktime(dt.timetuple()) handle correctly tzinfo? And how do you get a
UNIX timestamp in the UTC timezone? (dt.utctotimestamp())
I tried to implement datetime.totimestamp() but I lost my mind in timezone.
It took me weeks to understand that the French timezone lost two hour near
1940 because of the World War II (to uniformize French and German
timezones)... France has not least than 12 timezones (the country, not
Metropolitan France) :-)
There is also the question of daylight saving time... Handling time is too
complex for my brain :-)
So I'm +1 for a simple datetime.totimestamp() method. But I'm unable to
write or review it.
Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120604/0e72dd5e/attachment.html>
More information about the Python-Dev
mailing list