-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimeCheck.py
More file actions
41 lines (37 loc) · 1.1 KB
/
Copy pathtimeCheck.py
File metadata and controls
41 lines (37 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import time
import psutil
import GuiClass
f = None
try:
f = open("time_tracker.txt", "r+")
except:
print("Initializing and creating a new file to write to with time: 0 hours")
f = open("time_tracker.txt", "x")
f.write("0")
f = open("time_tracker.txt", "r+")
original_time = int(f.readline())
open("time_tracker.txt", "w")
start_time = 0
has_been_accessed = 0
string = GuiClass.exe
if len(string) != 0:
print (string)
while True:
time.sleep(.5)
if ("League of Legends.exe" in (i.name() for i in psutil.process_iter())):
if (has_been_accessed == 0):
start_time = time.time()
print("i got here!!")
print(start_time)
has_been_accessed = 1
else:
if (start_time != 0):
print("Im here")
end_time = time.time()
start_time = start_time / 60 / 60
end_time = end_time / 60 / 60
actual_time = start_time - end_time
original_time = original_time + actual_time
f.write(str(original_time))
start_time = 0
has_been_accessed = 0