Kaydet (Commit) df7027bb authored tarafından Alexander Belopolsky's avatar Alexander Belopolsky

Reuse us_per_second in delta_total_seconds.

üst 0d4f94a7
...@@ -2252,22 +2252,14 @@ delta_total_seconds(PyObject *self) ...@@ -2252,22 +2252,14 @@ delta_total_seconds(PyObject *self)
{ {
PyObject *total_seconds; PyObject *total_seconds;
PyObject *total_microseconds; PyObject *total_microseconds;
PyObject *one_million;
total_microseconds = delta_to_microseconds((PyDateTime_Delta *)self); total_microseconds = delta_to_microseconds((PyDateTime_Delta *)self);
if (total_microseconds == NULL) if (total_microseconds == NULL)
return NULL; return NULL;
one_million = PyLong_FromLong(1000000L); total_seconds = PyNumber_TrueDivide(total_microseconds, us_per_second);
if (one_million == NULL) {
Py_DECREF(total_microseconds);
return NULL;
}
total_seconds = PyNumber_TrueDivide(total_microseconds, one_million);
Py_DECREF(total_microseconds); Py_DECREF(total_microseconds);
Py_DECREF(one_million);
return total_seconds; return total_seconds;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment