Fix APRSDStats start_time

This commit is contained in:
Hemna 2024-04-20 17:07:48 -04:00
parent 813bc7ea29
commit 29d97d9f0c
1 changed files with 2 additions and 3 deletions

View File

@ -14,6 +14,7 @@ class APRSDStats:
"""The AppStats class is used to collect stats from the application."""
_instance = None
start_time = None
def __new__(cls, *args, **kwargs):
"""Have to override the new method to make this a singleton
@ -22,11 +23,9 @@ class APRSDStats:
"""
if not cls._instance:
cls._instance = super().__new__(cls)
cls._instance.start_time = datetime.datetime.now()
return cls._instance
def __init__(self):
self.start_time = datetime.datetime.now()
def uptime(self):
return datetime.datetime.now() - self.start_time