Revision 806e5979
Added by Phil Davis almost 12 years ago
usr/local/www/includes/functions.inc.php | ||
---|---|---|
8 | 8 |
} |
9 | 9 |
|
10 | 10 |
require_once("config.inc"); |
11 |
require_once("pfsense-utils.inc"); |
|
11 | 12 |
|
12 | 13 |
function get_stats() { |
13 | 14 |
$stats['cpu'] = cpu_usage(); |
... | ... | |
77 | 78 |
} |
78 | 79 |
|
79 | 80 |
function get_uptime() { |
80 |
$boottime = ""; |
|
81 |
$matches = ""; |
|
82 |
exec("/sbin/sysctl -n kern.boottime", $boottime); |
|
83 |
preg_match("/sec = (\d+)/", $boottime[0], $matches); |
|
84 |
$boottime = $matches[1]; |
|
85 |
$uptime = time() - $boottime; |
|
81 |
$uptime = get_uptime_sec(); |
|
86 | 82 |
|
87 |
if(intval($boottime) == 0) |
|
88 |
return; |
|
89 | 83 |
if(intval($uptime) == 0) |
90 | 84 |
return; |
91 | 85 |
|
Also available in: Unified diff
Call get_uptime_sec from functions.inc.php
to avoid code duplication