Issue #8644: Improve accuracy of timedelta.total_seconds, by doing intermediate
computations with integer arithmetic instead of floating point.
td.total_seconds() now agrees with td / timedelta(seconds = 1).
Thanks Alexander Belopolsky for the patch.
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
index 758e4d2..908a792 100644
--- a/Doc/library/datetime.rst
+++ b/Doc/library/datetime.rst
@@ -287,7 +287,10 @@
.. method:: timedelta.total_seconds()
Return the total number of seconds contained in the duration. Equivalent to
- ``td.microseconds / 1000000 + td.seconds + td.days * 24 * 3600``.
+ ``td / timedelta(seconds=1)``.
+
+ Note that for very large time intervals (greater than 270 years on
+ most platforms) this method will lose microsecond accuracy.
.. versionadded:: 3.2