[issue9528] Add pure Python implementation of time module to CPython
Alexander Belopolsky
report at bugs.python.org
Fri Aug 6 06:33:24 CEST 2010
New submission from Alexander Belopolsky <belopolsky at users.sourceforge.net>:
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 msg99774. 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 msg107303.
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.
----------
assignee: belopolsky
components: Extension Modules, Library (Lib)
messages: 113073
nosy: amaury.forgeotdarc, belopolsky, brett.cannon, brian.curtin, davidfraser, durban, giampaolo.rodola, haypo, lemburg, mark.dickinson, merwok, pitrou, r.david.murray, rhettinger, techtonik, tim_one
priority: normal
severity: normal
status: open
title: Add pure Python implementation of time module to CPython
type: feature request
versions: Python 3.2
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9528>
_______________________________________
More information about the Python-bugs-list
mailing list