[issue2494] Can't round-trip datetimes-timestamps prior to 1970 on Windows

2010-12-21 Thread R. David Murray

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 tracker rep...@bugs.python.org
http://bugs.python.org/issue2494
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2494] Can't round-trip datetimes-timestamps prior to 1970 on Windows

2008-11-10 Thread STINNER Victor

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:
http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=7269

--
nosy: +haypo

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2494
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2494] Can't round-trip datetimes-timestamps prior to 1970 on Windows

2008-03-27 Thread Mark Summerfield

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:
pastdate_x = datetime.datetime.utcfromtimestamp(timestamp)
except ValueError as err:
print(FAIL, err)
try:
print(time.strftime(%Y-%m-%dT%H:%M:%S, time.gmtime(timestamp)))
except ValueError as err:
print(FAIL, err)

r
Python 30a3

Windows output:

1969-12-31 00:00:00
-86400
FAIL timestamp out of range for platform localtime()/gmtime() function
FAIL (22, 'Invalid argument')

Linux output:
1969-12-31 00:00:00
-86400
1969-12-31T00:00:00

# What this appears to show is that you can't round-trip between
datetimes and timestamps on Windows for dates prior to 1970

--
components: Library (Lib)
messages: 64578
nosy: mark
severity: normal
status: open
title: Can't round-trip datetimes-timestamps prior to 1970 on Windows
type: behavior
versions: Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2494
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2494] Can't round-trip datetimes-timestamps prior to 1970 on Windows

2008-03-27 Thread Christian Heimes

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
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com