[pypy-issue] [issue972] inconsistence with cpython (datetime?)

mikefc tracker at bugs.pypy.org
Sun Dec 25 14:32:18 CET 2011


mikefc <coolbutuseless at gmail.com> added the comment:

Is this just a rounding error depending upon math implementations?

I'm running on OSX

============================= running a nightly from Dec19
~/pypy-latest/bin/pypy 
Python 2.7.1 (16d3f098e8ec, Dec 19 2011, 02:00:15)
>>>> from datetime import datetime
>>>> t1 = 1324495440.299935
>>>> t2 = 1324495440.500568
>>>> datetime.utcfromtimestamp(t2) - datetime.fromtimestamp(t2)
datetime.timedelta(-1, 50399, 999999)
>>>> datetime.utcfromtimestamp(t1) - datetime.fromtimestamp(t1)
datetime.timedelta(-1, 50400)
>>>> 


============================= CPython 2.7.2
In [1]: from datetime import datetime
In [2]: t1 = 1324495440.299935
In [3]: t2 = 1324495440.500568
In [4]: datetime.utcfromtimestamp(t2) - datetime.fromtimestamp(t2)
Out[4]: datetime.timedelta(-1, 50400)
In [5]: datetime.utcfromtimestamp(t1) - datetime.fromtimestamp(t1)
Out[5]: datetime.timedelta(-1, 50400)

----------
nosy: +mikefc
status: unread -> chatting

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue972>
________________________________________


More information about the pypy-issue mailing list