diff --git a/owrx/controllers/services.py b/owrx/controllers/services.py index 7944944d..636903bf 100644 --- a/owrx/controllers/services.py +++ b/owrx/controllers/services.py @@ -43,21 +43,26 @@ class ServiceController(AuthorizationMixin, WebpageController): ) @staticmethod - def renderStatus(): - result = "" - ts = datetime.fromtimestamp(EIBI.lastStarted()) + def renderTime(ts): + ts = datetime.fromtimestamp(ts) td = str(datetime.now() - ts).split(".", 1)[0] ts = ts.astimezone().strftime("%H:%M:%S %Z, %d %b %Y") - result += "
Server started at {0}, {1} ago.
\n".format(ts, td) + return ts + ", " + td + " ago" + + @staticmethod + def renderStatus(): + result = "" + ts = ServiceController.renderTime(EIBI.lastStarted()) + result += "
Server started at {0}.
\n".format(ts) ts = EIBI.lastDownloaded() if ts > 0: - ts = datetime.fromtimestamp(ts).astimezone().strftime("%H:%M:%S %Z, %d %b %Y") + ts = ServiceController.renderTime(ts) result += "
Shortwave schedule downloaded at {0}.
\n".format(ts) else: result += "
Shortwave schedule not downloaded.
\n" ts = Repeaters.lastDownloaded() if ts > 0: - ts = datetime.fromtimestamp(ts).astimezone().strftime("%H:%M:%S %Z, %d %b %Y") + ts = ServiceController.renderTime(ts) result += "
Repeaters database downloaded at {0}.
\n".format(ts) else: result += "
Repeaters database not downloaded.
\n"