From 516fa84b1c7b2dfa1f95ed237937104045501e9b Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Thu, 13 Mar 2025 17:58:08 +0000 Subject: [PATCH 1/3] Clean up timestamp docs --- Doc/library/datetime.rst | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 1af7d6be750102..fd9a5f4f598da2 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1485,13 +1485,6 @@ Instance methods: instance. The return value is a :class:`float` similar to that returned by :func:`time.time`. - Naive :class:`.datetime` instances are assumed to represent local - time and this method relies on the platform C :c:func:`mktime` - function to perform the conversion. Since :class:`.datetime` - supports wider range of values than :c:func:`mktime` on many - platforms, this method may raise :exc:`OverflowError` or :exc:`OSError` - for times far in the past or far in the future. - For aware :class:`.datetime` instances, the return value is computed as:: @@ -1503,6 +1496,10 @@ Instance methods: The :meth:`timestamp` method uses the :attr:`.fold` attribute to disambiguate the times during a repeated interval. + .. versionchanged:: 3.6 + This method no longer relies on the platform C :c:func:`mktime` + function to perform conversions. + .. note:: There is no method to obtain the POSIX timestamp directly from a From 9b70a5aed541588469282e42b42fdebc0667d7ff Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Tue, 20 May 2025 16:57:05 +0100 Subject: [PATCH 2/3] Update datetime.rst --- Doc/library/datetime.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index fd9a5f4f598da2..b1b6fcd5c21afa 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1485,6 +1485,13 @@ Instance methods: instance. The return value is a :class:`float` similar to that returned by :func:`time.time`. + Naive :class:`.datetime` instances are assumed to represent local + time and this method relies on the platform C :c:func:`locatime_s` + function to perform the conversion. Since :class:`.datetime` + supports wider range of values than :c:func:`locatime_s` on many + platforms, this method may raise :exc:`OverflowError` or :exc:`OSError` + for times far in the past or far in the future. + For aware :class:`.datetime` instances, the return value is computed as:: From e39c97dad8c6fbc32bdbe4e476dc6b7433b18349 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Tue, 20 May 2025 17:09:21 +0100 Subject: [PATCH 3/3] Suggestion --- Doc/library/datetime.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index b1b6fcd5c21afa..9ffbdb9649a9cf 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1486,11 +1486,11 @@ Instance methods: returned by :func:`time.time`. Naive :class:`.datetime` instances are assumed to represent local - time and this method relies on the platform C :c:func:`locatime_s` - function to perform the conversion. Since :class:`.datetime` - supports wider range of values than :c:func:`locatime_s` on many - platforms, this method may raise :exc:`OverflowError` or :exc:`OSError` - for times far in the past or far in the future. + time and this method relies on platform C functions to perform + the conversion. Since :class:`.datetime` supports a wider range of + values than the platform C functions on many platforms, this + method may raise :exc:`OverflowError` or :exc:`OSError` for times + far in the past or far in the future. For aware :class:`.datetime` instances, the return value is computed as::