From 1d7c32a52f2927d59d04db9c902a0124cea856b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 17 Jul 2025 12:34:52 -0400 Subject: [PATCH] refactor: show both days and hours --- src/controllers/admin/info.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/controllers/admin/info.js b/src/controllers/admin/info.js index 6f63faf8a9..3c0457cd82 100644 --- a/src/controllers/admin/info.js +++ b/src/controllers/admin/info.js @@ -117,14 +117,18 @@ function getCpuUsage() { } function humanReadableUptime(seconds) { + const oneHourInSeconds = 3600; + const oneDayInSeconds = oneHourInSeconds * 24; if (seconds < 60) { return `${Math.floor(seconds)}s`; - } else if (seconds < 3600) { + } else if (seconds < oneHourInSeconds) { return `${Math.floor(seconds / 60)}m`; - } else if (seconds < 3600 * 24) { + } else if (seconds < oneDayInSeconds) { return `${Math.floor(seconds / (60 * 60))}h`; } - return `${Math.floor(seconds / (60 * 60 * 24))}d`; + const days = Math.floor(seconds / (oneDayInSeconds)); + const hours = Math.floor((seconds % (oneDayInSeconds)) / oneHourInSeconds); + return `${days}d ${hours}h`; } async function getGitInfo() {