From 1ea023bb6d79bf4c3337fc262a96d811fb93d76c Mon Sep 17 00:00:00 2001 From: Azareal Date: Mon, 24 Feb 2020 21:48:16 +1000 Subject: [PATCH] tweak uptime format on debug page --- routes/panel/debug.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/routes/panel/debug.go b/routes/panel/debug.go index 53a22c49..ea52fe35 100644 --- a/routes/panel/debug.go +++ b/routes/panel/debug.go @@ -20,7 +20,8 @@ func Debug(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError { dbVersion := qgen.Builder.DbVersion() upDuration := time.Since(c.StartTime) hours := int(upDuration.Hours()) - minutes := int(upDuration.Minutes()) + mins := int(upDuration.Minutes()) + secs := int(upDuration.Seconds()) var uptime string if hours > 24 { days := hours / 24 @@ -28,9 +29,14 @@ func Debug(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError { uptime += strconv.Itoa(days) + "d" uptime += strconv.Itoa(hours) + "h" } else if hours >= 1 { + mins -= hours * 60 uptime += strconv.Itoa(hours) + "h" + uptime += strconv.Itoa(mins) + "m" + } else if mins >= 1 { + secs -= mins * 60 + uptime += strconv.Itoa(mins) + "m" + uptime += strconv.Itoa(secs) + "s" } - uptime += strconv.Itoa(minutes) + "m" dbStats := qgen.Builder.GetConn().Stats() openConnCount := dbStats.OpenConnections