tic-far-toe/Timer.py
oto 7b486881d9 Create Timer.py
Pulled it out of GameLogic class. Makes sense to keep it separate.
2022-08-15 07:26:15 +03:00

18 lines
367 B
Python

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()