From 06641a2eeb04cdb9386eb436daba2ad62e2026c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 1 Sep 2020 15:23:42 +0200 Subject: [PATCH] add subsecond support to soxi fallback --- emissions/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emissions/utils.py b/emissions/utils.py index c70c184..366d567 100644 --- a/emissions/utils.py +++ b/emissions/utils.py @@ -30,10 +30,10 @@ def get_duration(filename): if not line.startswith('Duration'): continue try: - hours, minutes, seconds = re.findall(r'(\d\d):(\d\d):(\d\d)', line)[0] + hours, minutes, seconds, cs = re.findall(r'(\d\d):(\d\d):(\d\d)\.(\d\d)', line)[0] except IndexError: continue - return int(hours) * 3600 + int(minutes) * 60 + int(seconds) + return int(hours) * 3600 + int(minutes) * 60 + int(seconds) + (int(cs) / 100) return None -- GitLab