mirror of
https://github.com/craigerl/aprsd.git
synced 2025-04-08 12:38:39 -04:00
Fix APRSDStats start_time
This commit is contained in:
parent
813bc7ea29
commit
29d97d9f0c
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user