[issue9527] Add aware local time support to datetime module

Alexander Belopolsky report at bugs.python.org
Tue Jun 12 04:27:40 CEST 2012


Alexander Belopolsky <alexander.belopolsky at gmail.com> added the comment:

Two objections have been raised to the proposed datetime.localtime() function:

1. It offers the third subtly different way to obtain current time in datetime module.  The first two being provided by datetime.now() and datetime.today().

2. C library localtime function takes POSIX timestamp as an argument, so datetime.localtime() should follow suit.

I attach a prototype patch for a different approach: make datetime.astimezone() method supply local timezone information if no argument is given.

This patch also demonstrates that extracting all TZ information that platform may have knowledge of is not trivial.

----------
Added file: http://bugs.python.org/file25939/datetime-astimezone-proto.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9527>
_______________________________________


More information about the Python-bugs-list mailing list