Project

General

Profile

« Previous | Next » 

Revision 3bea1321

Added by Stilez y about 9 years ago

optional arg for old behaviour
(cherry picked from commit cf63f1638aab685cc956502f5ddd862a10bf3ff8)

View differences:

src/etc/inc/pfsense-utils.inc
1144 1144
	return $pppoeenable;
1145 1145
}
1146 1146

  
1147
function convert_seconds_to_dhms($sec) {
1147
/* Optional arg forces hh:mm:ss without days */
1148
function convert_seconds_to_dhms($sec, $showhoursonly = false) {
1148 1149
	if (!is_numericint($sec)) {
1149 1150
		return '-';
1150 1151
	}
1151 1152
	// FIXME: When we move to PHP 7 we can use "intdiv($sec % X, Y)" etc
1152
	list($d, $h, $m, $s) = array(	(int)($sec/86400),
1153
					(int)(($sec % 86400)/3600),
1153
	list($d, $h, $m, $s) = array(	(int)($showhoursonly ? 0 : $sec/86400),
1154
					(int)($showhoursonly ? $sec : $sec % 86400)/3600),
1154 1155
					(int)(($sec % 3600)/60),
1155 1156
					$sec % 60
1156 1157
				);

Also available in: Unified diff