summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2013-08-04 19:18:58 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2013-08-04 19:18:58 (GMT)
commitdf7027bb9e3e80fcebca0c1ccb447ad225516cf7 (patch)
tree3cf32e035908a72bef47b2dca074938e67456173 /Modules
parent0d4f94a739c95a971774e6a9e72dfee7c973303f (diff)
downloadcpython-df7027bb9e3e80fcebca0c1ccb447ad225516cf7.zip
cpython-df7027bb9e3e80fcebca0c1ccb447ad225516cf7.tar.gz
cpython-df7027bb9e3e80fcebca0c1ccb447ad225516cf7.tar.bz2
Reuse us_per_second in delta_total_seconds.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_datetimemodule.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index d3929c7..91d30a0 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -2252,22 +2252,14 @@ delta_total_seconds(PyObject *self)
{
PyObject *total_seconds;
PyObject *total_microseconds;
- PyObject *one_million;
total_microseconds = delta_to_microseconds((PyDateTime_Delta *)self);
if (total_microseconds == NULL)
return NULL;
- one_million = PyLong_FromLong(1000000L);
- if (one_million == NULL) {
- Py_DECREF(total_microseconds);
- return NULL;
- }
-
- total_seconds = PyNumber_TrueDivide(total_microseconds, one_million);
+ total_seconds = PyNumber_TrueDivide(total_microseconds, us_per_second);
Py_DECREF(total_microseconds);
- Py_DECREF(one_million);
return total_seconds;
}