diff options
author | Sjur Fredriksen <sjurtf@ifi.uio.no> | 2017-11-12 14:05:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-12 14:05:45 +0100 |
commit | 6592de6d66fcb63c2bee48cf436d81df5bde3934 (patch) | |
tree | d1f1bff7d9ced74e4d20c6d431c6e10a936da729 /web | |
parent | adb0a20a586ffe961583d218ac374d86e2a38a22 (diff) |
Added support to calculate uptime in days
Diffstat (limited to 'web')
-rw-r--r-- | web/js/nms-map-handlers.js | 9 |
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 == "") |