aboutsummaryrefslogtreecommitdiff
path: root/src/Watcher/time_operations.py
diff options
context:
space:
mode:
authorLibravatar Waishnav <[email protected]>2022-03-12 22:38:01 +0530
committerLibravatar Waishnav <[email protected]>2022-03-12 22:38:01 +0530
commit6352e4288ab5489c57ead68b97e3fc1f60bc6097 (patch)
tree3c0d76c049a0dfbca55d3917ce824510a72cf321 /src/Watcher/time_operations.py
parent5ff9b08a4230210572c4b02dfc784c31c1986dea (diff)
downloadshopno-os-log-sync-6352e4288ab5489c57ead68b97e3fc1f60bc6097.tar.gz
shopno-os-log-sync-6352e4288ab5489c57ead68b97e3fc1f60bc6097.zip
completed week overview feature
Diffstat (limited to '')
-rwxr-xr-xsrc/Watcher/time_operations.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/Watcher/time_operations.py b/src/Watcher/time_operations.py
index 4145e8d..066a15e 100755
--- a/src/Watcher/time_operations.py
+++ b/src/Watcher/time_operations.py
@@ -9,12 +9,17 @@ def time_difference(a,b): # b - a
sec = 60 + sec
if hr < 0:
hr = hr + 24
- elif int(mn) < 0 and int(sec) > 0:
+ elif int(mn) < 0 and int(sec) >= 0:
hr = hr - 1
mn = 60 + mn
elif int(sec) < 0 and int(mn) > 0:
sec = 60 + sec
mn = mn - 1
+ elif int(sec) < 0 and int(mn) == 0:
+ hr = hr - 1
+ mn = 59
+ sec = 60 + sec
+ #elif int(mn) < 0:
hr = str(hr).zfill(2)
mn = str(mn).zfill(2)
@@ -45,13 +50,14 @@ def time_addition(a,b):
return result
-def convert_time(t):
- if int(t[0:2]) == 0:
- result = t[3:5] + 'm ' + t[6::] + 's'
- if int(t[3:5]) == 0:
- result = t[6::] + 's'
- else:
- result = t[0:2] + 'h ' + t[3:5] + 'm ' + t[6::] + 's'
+def format_time(t):
+ result = t[0:2] + 'h ' + t[3:5] + 'm ' + t[6::] + 's'
+ #if int(t[0:2]) == 0:
+ # result = t[3:5] + 'm ' + t[6::] + 's'
+ # if int(t[3:5]) == 0:
+ # result = t[6::] + 's'
+ #else:
+ # result = t[0:2] + 'h ' + t[3:5] + 'm ' + t[6::] + 's'
return result
def convert_into_sec(t):