[Python-ideas] Reduce platform dependence of date and time related functions

Alexander Belopolsky alexander.belopolsky at gmail.com
Wed Sep 18 19:37:53 CEST 2013


On Wed, Sep 18, 2013 at 1:20 PM, <random832 at fastmail.us> wrote:

> We're going around in circles. I'm proposing _removing_ those
> limitations, so that for example code written for Unix systems (that
> assumes it can use negative values before 1970) will work on Windows,
> and code written for 64-bit systems will work on systems whose native
> time_t is 32 bits.
>

That's a sign that this discussion should move to the tracker where a
concrete patch can be proposed and discussed.  There is at least one
proposal that seems to be controversial: remove platform-dependent code
from datetime.utcfromtimestamp().

The change is trivial:

def utcfromtimestamp(seconds):
      return datetime(1970, 1, 1) + timedelta(seconds=seconds)

I will gladly apply such patch once it is complete with tests and C code.

The case for changing time.gmtime() is weaker.  We would have to add
additional dependency of time module on datetime or move or duplicate a
sizable chunk of C code.  If someone wants to undertake this project, I
would like to see an attempt to remove circular dependency between time and
datetime modules rather than couple the two modules even more tightly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130918/f68d9c3e/attachment-0001.html>


More information about the Python-ideas mailing list