Create Timer.py

Pulled it out of GameLogic class. Makes sense to keep it separate.
This commit is contained in:
otomo otonami 2022-08-15 07:26:15 +03:00
parent b11f77f7ef
commit 7b486881d9

18
Timer.py Normal file
View File

@ -0,0 +1,18 @@
from datetime import datetime, time
class Timer():
def __init__(self):
self.startTime = 0
def has_second_passed(self):
return self.get_time() > 1
def get_time(self):
return str(datetime.now() - self.startTime)
def reset_time(self):
self.startTime = datetime.now()