aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLibravatar Waishnav <waishnavdeore@gmail.com>2022-05-15 11:01:05 +0530
committerLibravatar Waishnav <waishnavdeore@gmail.com>2022-05-15 11:01:05 +0530
commitd5da5be46fb459959d64f52c310c8ab08163ae21 (patch)
tree3002a421598838b20cfe6553a11f305a34c1ac56 /src
parent2484d5c717eb6ee649825c1cdf8b8b74fac47197 (diff)
downloadshopno-os-log-sync-d5da5be46fb459959d64f52c310c8ab08163ae21.tar.gz
shopno-os-log-sync-d5da5be46fb459959d64f52c310c8ab08163ae21.zip
#Issue7 resolved time_difference error
Diffstat (limited to 'src')
-rwxr-xr-xsrc/Watcher/time_operations.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Watcher/time_operations.py b/src/Watcher/time_operations.py
index 08a42ef..df593b8 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])
@@ -9,9 +8,13 @@ def time_difference(a,b): # b - a
sec = 60 + sec
if hr < 0:
hr = hr + 24
+
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
@@ -22,7 +25,6 @@ def time_difference(a,b): # b - a
hr = hr - 1
mn = 59
sec = 60 + sec
- #elif int(mn) < 0:
hr = str(hr).zfill(2)
mn = str(mn).zfill(2)