Project

General

Profile

« Previous | Next » 

Revision df0cb10b

Added by Phil Davis almost 12 years ago

Provide get_uptime_sec in a common include file

so it is available to anything that cares.

View differences:

etc/inc/pfsense-utils.inc
1445 1445
	return exec("sysctl hw.clockrate | awk '{ print $2 }'");
1446 1446
}
1447 1447

  
1448
function get_uptime_sec() {
1449
	$boottime = "";
1450
	$matches = "";
1451
	exec("/sbin/sysctl -n kern.boottime", $boottime);
1452
	preg_match("/sec = (\d+)/", $boottime[0], $matches);
1453
	$boottime = $matches[1];
1454
	if(intval($boottime) == 0)
1455
		return 0;
1456

  
1457
	$uptime = time() - $boottime;
1458
	return $uptime;
1459
}
1460

  
1448 1461
function add_hostname_to_watch($hostname) {
1449 1462
	if(!is_dir("/var/db/dnscache")) {
1450 1463
		mkdir("/var/db/dnscache");

Also available in: Unified diff