summaryrefslogtreecommitdiff
path: root/morphlib/stopwatch.py
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/stopwatch.py')
-rw-r--r--morphlib/stopwatch.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/morphlib/stopwatch.py b/morphlib/stopwatch.py
index bcdc9291..492738d5 100644
--- a/morphlib/stopwatch.py
+++ b/morphlib/stopwatch.py
@@ -14,6 +14,8 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+import operator
+
from datetime import datetime
@@ -48,3 +50,9 @@ class Stopwatch(object):
def start_stop_delta(self, reference_object):
return (self.stop_time(reference_object) -
self.start_time(reference_object))
+
+ def start_stop_seconds(self, reference_object):
+ delta = self.start_stop_delta(reference_object)
+ return (delta.days * 24 * 3600 +
+ delta.seconds +
+ operator.truediv(delta.microseconds, 10**6))