aboutsummaryrefslogtreecommitdiff
path: root/src/Watcher/time_operations.py
diff options
context:
space:
mode:
authorLibravatar Waishnav <waishnavdeore@gmail.com>2022-07-08 21:45:45 +0530
committerLibravatar Waishnav <waishnavdeore@gmail.com>2022-07-08 21:45:45 +0530
commit7133173a8c33c8120af6006380aecf7846e6e0bd (patch)
tree308aaacaf8809971742ca11014a156f38a914ffa /src/Watcher/time_operations.py
parentfc1c852d9263fc43f27792f38a8e68674e944629 (diff)
downloadshopno-os-log-sync-7133173a8c33c8120af6006380aecf7846e6e0bd.tar.gz
shopno-os-log-sync-7133173a8c33c8120af6006380aecf7846e6e0bd.zip
refactoring some function
Diffstat (limited to '')
-rwxr-xr-xsrc/Watcher/time_operations.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Watcher/time_operations.py b/src/Watcher/time_operations.py
index 08a42ef..23326d9 100755
--- a/src/Watcher/time_operations.py
+++ b/src/Watcher/time_operations.py
@@ -1,4 +1,3 @@
-
def time_difference(a,b): # b - a
hr = int(b[0:2])-int(a[0:2])
mn = int(b[3:5])-int(a[3:5])
@@ -12,17 +11,17 @@ def time_difference(a,b): # b - a
elif mn < 0 and sec >= 0:
hr = hr - 1
mn = 60 + mn
+ if hr < 0:
+ hr = hr + 24
elif sec < 0 and mn > 0:
sec = 60 + sec
mn = mn - 1
if hr < 0:
hr = hr + 24
-
elif sec < 0 and mn == 0:
hr = hr - 1
mn = 59
sec = 60 + sec
- #elif int(mn) < 0:
hr = str(hr).zfill(2)
mn = str(mn).zfill(2)
@@ -50,7 +49,6 @@ def time_addition(a,b):
mn = str(mn).zfill(2)
sec = str(sec).zfill(2)
result = hr + ":" + mn + ":" + sec
-
return result
def format_time(t):
@@ -67,3 +65,4 @@ def convert_into_sec(t):
sec = int(t[0:2])*3600 + int(t[3:5])*60 + int(t[6::])
return sec
+