diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2012-03-13 23:39:29 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2012-03-13 23:39:29 (GMT) |
commit | ecc6e6613f8c1853830aa25a140c2d790bd330d5 (patch) | |
tree | e48651ca70e393b76cf48e5e6a542de1c412195b /Doc/library/datetime.rst | |
parent | b2a37733017c4a469147d00d539e5313afc19340 (diff) | |
download | cpython-ecc6e6613f8c1853830aa25a140c2d790bd330d5.zip cpython-ecc6e6613f8c1853830aa25a140c2d790bd330d5.tar.gz cpython-ecc6e6613f8c1853830aa25a140c2d790bd330d5.tar.bz2 |
Fix doc of datetime.date*.*fromtimestamp() methods
Diffstat (limited to 'Doc/library/datetime.rst')
-rw-r--r-- | Doc/library/datetime.rst | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index c8dcbc1..401a647 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -396,7 +396,8 @@ Other constructors, all class methods: Return the local date corresponding to the POSIX timestamp, such as is returned by :func:`time.time`. This may raise :exc:`OverflowError`, if the timestamp is out - of the range of values supported by the platform C :c:func:`localtime` function. + of the range of values supported by the platform C :c:func:`localtime` function, + and :exc:`OSError` on :c:func:`localtime` failure. It's common for this to be restricted to years from 1970 through 2038. Note that on non-POSIX systems that include leap seconds in their notion of a timestamp, leap seconds are ignored by :meth:`fromtimestamp`. @@ -710,9 +711,11 @@ Other constructors, all class methods: equivalent to ``tz.fromutc(datetime.utcfromtimestamp(timestamp).replace(tzinfo=tz))``. - :meth:`fromtimestamp` may raise :exc:`ValueError`, if the timestamp is out of + :meth:`fromtimestamp` may raise :exc:`OverflowError`, if the timestamp is out of the range of values supported by the platform C :c:func:`localtime` or - :c:func:`gmtime` functions. It's common for this to be restricted to years in + :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` or + :c:func:`gmtime` failure. + It's common for this to be restricted to years in 1970 through 2038. Note that on non-POSIX systems that include leap seconds in their notion of a timestamp, leap seconds are ignored by :meth:`fromtimestamp`, and then it's possible to have two timestamps differing by a second that yield @@ -729,8 +732,9 @@ Other constructors, all class methods: .. classmethod:: datetime.utcfromtimestamp(timestamp) Return the UTC :class:`.datetime` corresponding to the POSIX timestamp, with - :attr:`tzinfo` ``None``. This may raise :exc:`ValueError`, if the timestamp is - out of the range of values supported by the platform C :c:func:`gmtime` function. + :attr:`tzinfo` ``None``. This may raise :exc:`OverflowError`, if the timestamp is + out of the range of values supported by the platform C :c:func:`gmtime` function, + and :exc:`OSError` on :c:func:`gmtime` failure. It's common for this to be restricted to years in 1970 through 2038. See also :meth:`fromtimestamp`. |