[issue13882] PEP 410: Use decimal.Decimal type for timestamps

STINNER Victor report at bugs.python.org
Fri Feb 10 02:48:24 CET 2012


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

Patch version 14:

 - rewrite the conversion from float to _PyTime_t: use base 2 with high precision and then simplify the fraction. The conversion from decimal.Decimal uses base 10 and do also simplify the fraction.
 - write tests on functions converting _PyTime_t using _testcapi
 - add timestamp argument to signal.getitimer(), signal.setitimer(), resource.getrusage()
 - signal.sigtimedwait() uses _PyTime_t and now expects a number and no more a tuple (function added to Python 3.3, so no backward compatibility issue). See also the issue #13964
 - time.sleep() uses _PyTime_t. See also the issue #13981 (use nanosleep())
 - datetime.datetime.now() and datetime.datetime.utcnow() uses _PyTime_t
 - catch integer overflow on _PyTime_AsTimeval(), _PyTime_AsTimespec() and more

This patch gives you an overview of the whole PEP 410 implementation, but it should not be applied in one shot. It would be better to commit it step by step:

 - add _PyTime_t API
 - use _PyTime_t for the time module
 - use _PyTime_t for the os module
 - use _PyTime_t for the more modules
 - etc.

We can start by adding the API and use it in the time module, and then rediscuss changes on other modules.

----------
Added file: http://bugs.python.org/file24473/time_decimal-14.patch

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


More information about the Python-bugs-list mailing list