aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2012-07-03 12:19:43 -0400
committerjim-p <jimp@pfsense.org>2012-07-03 12:20:50 -0400
commit98dd6b041192af73c63321ceaf28eeba896373cb (patch)
tree4e467a1e257499165238dc0772206532f921b067 /config
parent33d59b6eae2a934250a0d7d53d3231d1d3702b81 (diff)
downloadpfsense-packages-98dd6b041192af73c63321ceaf28eeba896373cb.tar.gz
pfsense-packages-98dd6b041192af73c63321ceaf28eeba896373cb.tar.bz2
pfsense-packages-98dd6b041192af73c63321ceaf28eeba896373cb.zip
Show nut ups time remaining in a more friendly manner, variant of http://forum.pfsense.org/index.php/topic,42415.msg224534.html#msg224534
Diffstat (limited to 'config')
-rw-r--r--config/nut/status_nut.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/config/nut/status_nut.php b/config/nut/status_nut.php
index ca575d12..3bee0ba0 100644
--- a/config/nut/status_nut.php
+++ b/config/nut/status_nut.php
@@ -34,6 +34,13 @@ $nut_config = $config['installedpackages']['nut']['config'][0];
/* functions */
+function secs2hms($secs) {
+ if ($secs<0) return false;
+ $m = (int)($secs / 60); $s = $secs % 60;
+ $h = (int)($m / 60); $m = $m % 60;
+ return "{$h}h {$m}m {$s}s";
+}
+
function tblopen () {
print('<table width="100%" class="tabcont" cellspacing="0" cellpadding="6">'."\n");
}
@@ -224,7 +231,7 @@ include("head.inc");
tblclose();
tblopen();
- tblrow('Runtime Remaining:', $ups['battery.runtime'], ' seconds');
+ tblrow('Runtime Remaining:', secs2hms($ups['battery.runtime']), '');
tblrow('Battery Voltage:', $ups['battery.voltage'], 'V');
tblrow('Input Voltage:', $ups['input.voltage'], 'V');
tblrow('Input Frequency:', $ups['input.frequency'], 'Hz');