From dbdd18af3504d4918503e3d0f09fd5e4e3de6ef0 Mon Sep 17 00:00:00 2001
From: Robert Izzard <r.izzard@surrey.ac.uk>
Date: Tue, 12 Oct 2021 13:48:13 +0100
Subject: [PATCH] update timedelta to better handle days and the "x and" type
 strings

---
 binarycpython/utils/functions.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/binarycpython/utils/functions.py b/binarycpython/utils/functions.py
index 9ff2f3668..41a051655 100644
--- a/binarycpython/utils/functions.py
+++ b/binarycpython/utils/functions.py
@@ -77,7 +77,13 @@ def timedelta(delta):
     # currently use the humanize module to do this
     t = humanize.time.precisedelta(dt.timedelta(seconds=delta),format='%0.2f',minimum_unit='milliseconds',suppress=['milliseconds'])
     # and use more compact units
+    t = t.replace(" days and","d")
+    t = t.replace(" hours and","h")
+    t = t.replace(" minutes and","m")
+    t = t.replace(" seconds and","s")
+    t = t.replace(" days","d")
     t = t.replace(" hours","h")
+    t = t.replace(" minutes","m")
     t = t.replace(" seconds","s")
     return t
 
-- 
GitLab