]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2225_statistics] Revert "[2225_statistics] use timedelta.total_seconds() instead...
authorNaoki Kambe <naoki.kambe@gmail.com>
Tue, 15 Jan 2013 08:07:40 +0000 (17:07 +0900)
committerNaoki Kambe <kambe@jprs.co.jp>
Tue, 15 Jan 2013 08:27:39 +0000 (17:27 +0900)
This reverts commit 31b16f3568b95073fc15b68e435215572f25c5b8.

This is because timedelta.total_seconds() is not supported yet on Python3.1.

src/lib/python/isc/statistics/counters.py

index d824bda72c2eaf4c612638e7e637910b0d6324a8..8da0b1e8b576d702f1f5a801ed84d479c0f8abe3 100644 (file)
@@ -126,7 +126,8 @@ def _stop_timer(start_time, element, spec, identifier):
     the element, which is in seconds between start_time and the
     current time and is float-type."""
     delta = datetime.now() - start_time
-    sec = delta.total_seconds()
+    sec = round(delta.days * 86400 + delta.seconds + \
+                    delta.microseconds * 1E-6, 6)
     _set_counter(element, spec, identifier, sec)
 
 def _concat(*args, sep='/'):