[pypy-svn] r59440 - pypy/trunk/pypy/lib
fijal at codespeak.net
fijal at codespeak.net
Mon Oct 27 12:16:43 CET 2008
Author: fijal
Date: Mon Oct 27 12:16:41 2008
New Revision: 59440
Modified:
pypy/trunk/pypy/lib/datetime.py
Log:
some fixes
Modified: pypy/trunk/pypy/lib/datetime.py
==============================================================================
--- pypy/trunk/pypy/lib/datetime.py (original)
+++ pypy/trunk/pypy/lib/datetime.py Mon Oct 27 12:16:41 2008
@@ -1397,6 +1397,10 @@
converter = _time.localtime
else:
converter = _time.gmtime
+ if 1 - (t % 1.0) < 0.000001:
+ t = float(int(t)) + 1
+ if t < 0:
+ t -= 1
y, m, d, hh, mm, ss, weekday, jday, dst = converter(t)
us = int((t % 1.0) * 1000000)
ss = min(ss, 59) # clamp out leap seconds if the platform has them
@@ -1408,6 +1412,10 @@
def utcfromtimestamp(cls, t):
"Construct a UTC datetime from a POSIX timestamp (like time.time())."
+ if 1 - (t % 1.0) < 0.000001:
+ t = float(int(t)) + 1
+ if t < 0:
+ t -= 1
y, m, d, hh, mm, ss, weekday, jday, dst = _time.gmtime(t)
us = int((t % 1.0) * 1000000)
ss = min(ss, 59) # clamp out leap seconds if the platform has them
More information about the Pypy-commit
mailing list