From f38fa81c08795f3160fd1c0320840a5ec931304e Mon Sep 17 00:00:00 2001 From: Waishnav Date: Sat, 9 Jul 2022 07:54:06 +0530 Subject: fixing typo | changing some time.sleep() values so that low CPU will consume --- src/Watcher/get_windows.py | 2 +- src/Watcher/time_operations.py | 4 ---- src/Watcher/watch_log.py | 6 ++++-- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Watcher/get_windows.py b/src/Watcher/get_windows.py index 393c7ff..f895662 100755 --- a/src/Watcher/get_windows.py +++ b/src/Watcher/get_windows.py @@ -44,7 +44,7 @@ def active_window(): # returns true if user has move to next app which is not the same as previous def is_window_changed(a): result = False - time.sleep(0.1) + time.sleep(0.5) b = active_window() if a != b : result = True diff --git a/src/Watcher/time_operations.py b/src/Watcher/time_operations.py index b7d3224..1df4922 100755 --- a/src/Watcher/time_operations.py +++ b/src/Watcher/time_operations.py @@ -14,10 +14,6 @@ def time_difference(a,b): # b - a mn = 60 + mn if hr < 0: hr = hr + 24 -<<<<<<< HEAD - -======= ->>>>>>> afk_feature elif sec < 0 and mn > 0: sec = 60 + sec mn = mn - 1 diff --git a/src/Watcher/watch_log.py b/src/Watcher/watch_log.py index 4956deb..c8fbc95 100755 --- a/src/Watcher/watch_log.py +++ b/src/Watcher/watch_log.py @@ -43,16 +43,18 @@ def log_creation(): next_actv_window = x.active_window() date = get_date() opened_at = get_time() - time_spent = "00:00:00" + time.sleep(0.5) + time_spent = "00:00:01" append_line_in_csv(date, opened_at, time_spent, next_actv_window) else: + actv_window = x.active_window() date = get_date() now = get_time() # for next_window its the opening time last_line = os.popen("tail -n1 " + filename).read().split("\t") opened_at = last_line[0] os.popen("""sed -i -e '$ d' """ + filename) - time.sleep(0.2) + time.sleep(1) time_spnt = time_difference(opened_at, get_time()) if afk.IsAFK(): -- cgit v1.2.3