summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/pfsense-utils.inc
diff options
context:
space:
mode:
authorstilez <stilez@users.noreply.github.com>2016-05-31 07:23:54 +0100
committerstilez <stilez@users.noreply.github.com>2016-05-31 07:23:54 +0100
commitcf63f1638aab685cc956502f5ddd862a10bf3ff8 (patch)
treea2fbcfc978d40c16b4a1abd21958c55d5cff35a7 /src/etc/inc/pfsense-utils.inc
parentc57e936a6596550619f7261e85b633ca5016cbf2 (diff)
downloadpfsense-cf63f1638aab685cc956502f5ddd862a10bf3ff8.zip
pfsense-cf63f1638aab685cc956502f5ddd862a10bf3ff8.tar.gz
optional arg for old behaviour
Diffstat (limited to 'src/etc/inc/pfsense-utils.inc')
-rw-r--r--src/etc/inc/pfsense-utils.inc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc
index f9b31d1..fbdb59d 100644
--- a/src/etc/inc/pfsense-utils.inc
+++ b/src/etc/inc/pfsense-utils.inc
@@ -1144,13 +1144,14 @@ function is_pppoe_server_enabled() {
return $pppoeenable;
}
-function convert_seconds_to_dhms($sec) {
+/* Optional arg forces hh:mm:ss without days */
+function convert_seconds_to_dhms($sec, $showhoursonly = false) {
if (!is_numericint($sec)) {
return '-';
}
// FIXME: When we move to PHP 7 we can use "intdiv($sec % X, Y)" etc
- list($d, $h, $m, $s) = array( (int)($sec/86400),
- (int)(($sec % 86400)/3600),
+ list($d, $h, $m, $s) = array( (int)($showhoursonly ? 0 : $sec/86400),
+ (int)($showhoursonly ? $sec : $sec % 86400)/3600),
(int)(($sec % 3600)/60),
$sec % 60
);
OpenPOWER on IntegriCloud