diff options
author | 2022-03-19 10:46:48 +0530 | |
---|---|---|
committer | 2022-03-19 10:46:48 +0530 | |
commit | 098a0ff12f4970eff17e8c841fc4ba81bf715a6e (patch) | |
tree | b1dfbf311cdbaf78873258b3f7a00bdabdec7255 /src | |
parent | 06151831a1f75d26a616ab7bdfb5ee85505e7ee2 (diff) | |
download | shopno-os-log-sync-098a0ff12f4970eff17e8c841fc4ba81bf715a6e.tar.gz shopno-os-log-sync-098a0ff12f4970eff17e8c841fc4ba81bf715a6e.zip |
error fixed in time_differnece
Diffstat (limited to 'src')
-rwxr-xr-x | src/Watcher/time_operations.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Watcher/time_operations.py b/src/Watcher/time_operations.py index 066a15e..08a42ef 100755 --- a/src/Watcher/time_operations.py +++ b/src/Watcher/time_operations.py @@ -3,19 +3,22 @@ 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]) sec = int(b[6:8])-int(a[6:8]) - if int(mn) < 0 and int(sec) < 0: + if mn < 0 and sec < 0: hr = hr - 1 mn = 60 + mn - 1 sec = 60 + sec if hr < 0: hr = hr + 24 - elif int(mn) < 0 and int(sec) >= 0: + elif mn < 0 and sec >= 0: hr = hr - 1 mn = 60 + mn - elif int(sec) < 0 and int(mn) > 0: + elif sec < 0 and mn > 0: sec = 60 + sec mn = mn - 1 - elif int(sec) < 0 and int(mn) == 0: + if hr < 0: + hr = hr + 24 + + elif sec < 0 and mn == 0: hr = hr - 1 mn = 59 sec = 60 + sec |