mirror of https://github.com/craigerl/aprsd.git
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."""
|
"""The AppStats class is used to collect stats from the application."""
|
||||||
|
|
||||||
_instance = None
|
_instance = None
|
||||||
|
start_time = None
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
"""Have to override the new method to make this a singleton
|
"""Have to override the new method to make this a singleton
|
||||||
|
@ -22,11 +23,9 @@ class APRSDStats:
|
||||||
"""
|
"""
|
||||||
if not cls._instance:
|
if not cls._instance:
|
||||||
cls._instance = super().__new__(cls)
|
cls._instance = super().__new__(cls)
|
||||||
|
cls._instance.start_time = datetime.datetime.now()
|
||||||
return cls._instance
|
return cls._instance
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.start_time = datetime.datetime.now()
|
|
||||||
|
|
||||||
def uptime(self):
|
def uptime(self):
|
||||||
return datetime.datetime.now() - self.start_time
|
return datetime.datetime.now() - self.start_time
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue