From 7b486881d919bd06ed59546aa5520a34f639c16c Mon Sep 17 00:00:00 2001 From: oto Date: Mon, 15 Aug 2022 07:26:15 +0300 Subject: [PATCH] Create Timer.py Pulled it out of GameLogic class. Makes sense to keep it separate. --- Timer.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Timer.py diff --git a/Timer.py b/Timer.py new file mode 100644 index 0000000..ceb2006 --- /dev/null +++ b/Timer.py @@ -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() \ No newline at end of file