Message 113073 - Python tracker (original) (raw)
The original RFE at issue 7989 was:
""" After discussion on numerous issues, python-dev, and here at the PyCon sprints, it seems to be a good idea to move timemodule.c to _timemodule.c and convert as much as possible into pure Python. The same change seems good for datetime.c as well. """
See . I have changed issue 7989 to cover datetime only because I argued that as a thin wrapper around C library calls, this module is an exception to the general rule that pure python implementations are a good idea. See .
No I realize that in order to break circular dependency between time and datetime modules, it will be helpful to create an _time module that would provide lower than time module access to system facilities and datetime and time modules would be use _time module to implement higher level interfaces either in C or in Python.
I believe _time module should become the home of the gettimeofday() method and pure python implementation of time.time() will be
def time() s, us = _time.gettimeofday() return s + 1e-6 * us
Similarly time.sleep() can be implemented in terms of lower level POSIX nanosleep() method.
Lower level localtime() function can provide access to tm_zone and tm_gmtoff members of struct tm (where available) without concerns about backward compatibility.