aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Lyngstøl <kly@kly.no>2017-12-27 12:00:28 +0100
committerGitHub <noreply@github.com>2017-12-27 12:00:28 +0100
commit0016b6612e79cc5b115aae11c7f37ec2a27420e1 (patch)
tree94c78eca64ca218aa45e5a883dbbdb76e3d462d3
parent394893ce787840973021902f2dfb79a32399b35b (diff)
parent6592de6d66fcb63c2bee48cf436d81df5bde3934 (diff)
Merge pull request #166 from sjurtf/master
Added support to calculate uptime in days
-rw-r--r--web/js/nms-map-handlers.js9
1 files changed, 6 insertions, 3 deletions
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 == "")