diff options
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 |