From 6592de6d66fcb63c2bee48cf436d81df5bde3934 Mon Sep 17 00:00:00 2001 From: Sjur Fredriksen Date: Sun, 12 Nov 2017 14:05:45 +0100 Subject: Added support to calculate uptime in days --- web/js/nms-map-handlers.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'web/js/nms-map-handlers.js') diff --git a/web/js/nms-map-handlers.js b/web/js/nms-map-handlers.js index d5ded6f..22b9658 100644 --- a/web/js/nms-map-handlers.js +++ b/web/js/nms-map-handlers.js @@ -638,13 +638,16 @@ function snmpUpdater() { } function secondsToTime(input) { - var h, m, s; - h = Math.floor(input / 60 / 60); + var d, h, m, s; + d = Math.floor(input / 60 / 60 / 24); + h = Math.floor((input - (d * 24 * 3600)) / 60 / 60); m = Math.floor((input%3600)/60); s = Math.floor(input%60); var string = ""; + if (d > 0) + string = d + " days "; if (h > 0) - string = h + " hours "; + string += h + " hours "; if (h > 0 || m > 0) string += m + " minutes "; if (string == "") -- cgit v1.2.3