summaryrefslogtreecommitdiffstats
path: root/usr/local/www/includes/functions.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'usr/local/www/includes/functions.inc.php')
-rw-r--r--usr/local/www/includes/functions.inc.php42
1 files changed, 32 insertions, 10 deletions
diff --git a/usr/local/www/includes/functions.inc.php b/usr/local/www/includes/functions.inc.php
index 6769d0e..8ceea4d 100644
--- a/usr/local/www/includes/functions.inc.php
+++ b/usr/local/www/includes/functions.inc.php
@@ -86,13 +86,25 @@ function get_uptime() {
$uphours = (int)($uptime / 3600);
$uptime %= 3600;
$upmins = (int)($uptime / 60);
+ $uptime %= 60;
+ $upsecs = (int)($uptime);
$uptimestr = "";
if ($updays > 1)
- $uptimestr .= "$updays days, ";
+ $uptimestr .= "$updays Days ";
else if ($updays > 0)
- $uptimestr .= "1 day, ";
- $uptimestr .= sprintf("%02d:%02d", $uphours, $upmins);
+ $uptimestr .= "1 Day ";
+
+ if ($uphours > 1)
+ $hours = "s";
+
+ if ($upmins > 1)
+ $minutes = "s";
+
+ if ($upmins > 1)
+ $seconds = "s";
+
+ $uptimestr .= sprintf("%02d Hour$hours %02d Minute$minutes %02d Second$seconds", $uphours, $upmins, $upsecs);
return $uptimestr;
}
@@ -148,12 +160,22 @@ function get_hwtype() {
}
function get_temp() {
- switch(get_hwtype()) {
- default:
- return;
- }
-
- return $ret;
+// switch(get_hwtype()) {
+// default:
+// return;
+// }
+//
+// return $ret;
+
+ $temp_out = "";
+ exec("/sbin/sysctl dev.cpu.0.temperature | /usr/bin/awk '{ print $2 }' | /usr/bin/cut -d 'C' -f 1", $dfout);
+ $temp_out = trim($dfout[0]);
+ if ($temp_out == "") {
+ exec("/sbin/sysctl hw.acpi.thermal.tz0.temperature | /usr/bin/awk '{ print $2 }' | /usr/bin/cut -d 'C' -f 1", $dfout);
+ $temp_out = trim($dfout[0]);
+ }
+
+ return $temp_out;
}
function disk_usage()
@@ -264,4 +286,4 @@ function get_interfacestatus() {
return $data;
}
-?>
+?> \ No newline at end of file
OpenPOWER on IntegriCloud