From a84b80d7b021899ac74d828d45234cc2982e8f70 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 22 Nov 2022 16:23:26 -0500
Subject: linhes-dev: mp.py: add build time

---
 linhes/linhes-dev/PKGBUILD |  4 ++--
 linhes/linhes-dev/mp.py    | 53 ++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 49 insertions(+), 8 deletions(-)

diff --git a/linhes/linhes-dev/PKGBUILD b/linhes/linhes-dev/PKGBUILD
index 55d1b46..ceca506 100644
--- a/linhes/linhes-dev/PKGBUILD
+++ b/linhes/linhes-dev/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=linhes-dev
 pkgver=9.0.0
-pkgrel=4
+pkgrel=5
 pkgdesc="Scripts to develop LinHES"
 arch=('x86_64')
 license=('GPL2')
@@ -14,6 +14,6 @@ package() {
   install -D -m755 * ${pkgdir}/usr/bin/
 }
 sha256sums=('3a64b4125b56c6f95cc9dc85ce58ebd1c0612b22fb27c3e76d4d9a5570f2d61e'
-            'a633271346d0fc455a45a8bcc374f2e950472039f1410a62aeef69687700f286'
+            'd7afe023b5ba5ebb5e1a12d954651e435584034e5b00c37d9a70d0d6fe20643f'
             'b5d12503757471be72fa20fb86a0b1563916b4db85048dcd78b49eaade3db989'
             '86c9ebe77228f7e3cc07cb05f480e5584e0e3cad1b889b63a50821f7323bf449')
diff --git a/linhes/linhes-dev/mp.py b/linhes/linhes-dev/mp.py
index 33832d0..b1bdfa7 100755
--- a/linhes/linhes-dev/mp.py
+++ b/linhes/linhes-dev/mp.py
@@ -519,7 +519,44 @@ class Packagefile(object):
         filename = "%s/__changelog" %pkgdir
         return os.path.exists(filename)
 
-
+def formatTD(time):
+    # convert seconds to day, hour, minutes and seconds
+    days = time // (24 * 3600)
+    time = time % (24 * 3600)
+    hours = time // 3600
+    time %= 3600
+    minutes = time // 60
+    time %= 60
+    seconds = int(time)
+
+    if days == 0:
+      day_string = ""
+    elif days > 1:
+      day_string = "%s days, " %days
+    else:
+      day_string = "%s day, " %days
+
+    if hours == 0:
+      hour_string = ""
+    elif hours > 1:
+      hour_string = "%s hours, " %hours
+    else:
+      hour_string = "%s hour, " %hours
+
+    if minutes == 0:
+      minute_string = ""
+    elif minutes > 1:
+      minute_string = "%s minutes, " %minutes
+    else:
+      minute_string = "%s minute, " %minutes
+
+    if seconds > 1:
+      second_string = "%s seconds" %seconds
+    else:
+      second_string = "%s second" %seconds
+
+    return_string = '%s%s%s%s' % (day_string, hour_string, minute_string, second_string)
+    return return_string
 
 def main():
     pkg_not_found=[]
@@ -572,19 +609,23 @@ def main():
 
     print("\n")
     print("Couldn't find these packages:")
-    print("----------------------------")
+    print("---------------------------------")
     print(pkg_not_found)
 
     print("\n")
     print("Failed to compile these packages:")
-    print("----------------------------")
-    print( failed_compile)
+    print("---------------------------------")
+    print(failed_compile)
 
     print("\n")
     print("Successful compiled :")
-    print("---------------------------")
+    print("---------------------------------")
     print(success_pkg)
+    print("\n")
 
 if __name__ == "__main__":
+    start = time.time()
     main()
-    print("--------------------------")
+    end = time.time()
+    print("Build Time:",formatTD(end - start))
+    print("#######################################################")
-- 
cgit v0.12