18 lines
367 B
Python
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()
|