diff --git a/sdbs_infra/dashboard/static/main.css b/sdbs_infra/dashboard/static/main.css
index cd4cb7d..9bb418d 100644
--- a/sdbs_infra/dashboard/static/main.css
+++ b/sdbs_infra/dashboard/static/main.css
@@ -102,6 +102,10 @@ main {
color: darkred;
}
+footer {
+ text-align: justify;
+}
+
footer em {
font-style: normal;
font-weight: bold;
diff --git a/sdbs_infra/dashboard/views.py b/sdbs_infra/dashboard/views.py
index 7a3509f..b951ffd 100644
--- a/sdbs_infra/dashboard/views.py
+++ b/sdbs_infra/dashboard/views.py
@@ -1,8 +1,9 @@
import time
+from collections import namedtuple
import psutil
from django.views.generic import TemplateView
-from humanize import naturalsize, naturaldelta
+from humanize import naturalsize
from sdbs_infra.dashboard.models import Service
@@ -33,8 +34,18 @@ class IndexView(TemplateView):
f"DISK: {naturalsize(disk.used)}/{naturalsize(disk.total)} ({disk.percent}% USED)"
)
+ uptime = normalize_seconds(time.time() - psutil.boot_time())
+
stats.append(
- f"UPTIME: {naturaldelta(time.time() - psutil.boot_time())}"
+ f"UPTIME: {int(uptime.days)} days, {int(uptime.hours)} hours, {int(uptime.minutes)} minutes"
)
- return " / ".join(stats)
+ return " / ".join(map(lambda stat: stat.replace(" ", " "), stats))
+
+
+def normalize_seconds(seconds: int):
+ (days, remainder) = divmod(seconds, 86400)
+ (hours, remainder) = divmod(remainder, 3600)
+ (minutes, seconds) = divmod(remainder, 60)
+
+ return namedtuple("_", ("days", "hours", "minutes", "seconds"))(days, hours, minutes, seconds)