R. David Murray rdmur...@bitdance.com added the comment:
Indeed, the time module is documented as not handling timestamps before the
epoch.
--
nosy: +r.david.murray
resolution: - invalid
stage: - committed/rejected
status: open - closed
___
Python
STINNER Victor [EMAIL PROTECTED] added the comment:
If you doesn't care to the time zone (UTC), use:
datetime.datetime(1970, 1, 1) + datetime.timedelta(seconds=-86400)
datetime.datetime(1969, 12, 31, 0, 0)
This code is portable on Windows, Linux but also works with
IronPython:
New submission from Mark Summerfield [EMAIL PROTECTED]:
# If you run the code below on Py30a3 you get the output shown at the end
import calendar, datetime, time
pastdate = datetime.datetime(1969, 12, 31)
print(pastdate)
timestamp = calendar.timegm(pastdate.utctimetuple())
print(timestamp)
try:
Christian Heimes [EMAIL PROTECTED] added the comment:
It's most likely a platform limitation. Some platforms doen't support
negative time stamps.
--
nosy: +tiran
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2494