mirror of
https://github.com/ShaYmez/xlxd.git
synced 2024-12-25 03:47:18 -05:00
76 lines
2.4 KiB
PHP
76 lines
2.4 KiB
PHP
|
<?php
|
||
|
// ----------------------------------------------------------------------------
|
||
|
// xlxd
|
||
|
//
|
||
|
// Created by Luc Engelmann (LX1IQ) on 31/12.2015
|
||
|
// Copyright © 2015 Luc Engelmann (LX1IQ). All rights reserved.
|
||
|
//
|
||
|
// ----------------------------------------------------------------------------
|
||
|
// This file is part of xlxd.
|
||
|
//
|
||
|
// xlxd is free software: you can redistribute it and/or modify
|
||
|
// it under the terms of the GNU General Public License as published by
|
||
|
// the Free Software Foundation, either version 3 of the License, or
|
||
|
// (at your option) any later version.
|
||
|
//
|
||
|
// xlxd is distributed in the hope that it will be useful,
|
||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
// GNU General Public License for more details.
|
||
|
//
|
||
|
// You should have received a copy of the GNU General Public License
|
||
|
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||
|
// ----------------------------------------------------------------------------
|
||
|
|
||
|
function GetSystemUptime() {
|
||
|
$out = exec("uptime");
|
||
|
return substr($out, 0, strpos($out, ","));
|
||
|
}
|
||
|
|
||
|
function Debug($message) {
|
||
|
echo '<br><hr><pre>';
|
||
|
print_r($message);
|
||
|
echo '</pre><hr><br>';
|
||
|
}
|
||
|
|
||
|
function ParseTime($Input) {
|
||
|
|
||
|
if (strpos($Input, "<") !== false) {
|
||
|
$Input = substr($Input, 0, strpos($Input, "<"));
|
||
|
}
|
||
|
|
||
|
// Tuesday Tue Nov 17 14:23:22 2015
|
||
|
$tmp = explode(" ", $Input);
|
||
|
if (strlen(trim($tmp[3])) == 0) {
|
||
|
unset($tmp[3]);
|
||
|
$tmp = array_values($tmp);
|
||
|
}
|
||
|
|
||
|
$tmp1 = explode(":", $tmp[4]);
|
||
|
$month = "";
|
||
|
switch (strtolower($tmp[2])) {
|
||
|
case 'jan' : $month = 1; break;
|
||
|
case 'feb' : $month = 2; break;
|
||
|
case 'mar' : $month = 3; break;
|
||
|
case 'apr' : $month = 4; break;
|
||
|
case 'mai' : $month = 5; break;
|
||
|
case 'jun' : $month = 6; break;
|
||
|
case 'jul' : $month = 7; break;
|
||
|
case 'aug' : $month = 8; break;
|
||
|
case 'sep' : $month = 9; break;
|
||
|
case 'oct' : $month = 10; break;
|
||
|
case 'nov' : $month = 11; break;
|
||
|
case 'dec' : $month = 12; break;
|
||
|
default : $month = 1;
|
||
|
}
|
||
|
return mktime($tmp1[0], $tmp1[1], $tmp1[2], $month, $tmp[3], $tmp[5]);
|
||
|
|
||
|
}
|
||
|
|
||
|
function FormatSeconds($seconds) {
|
||
|
$seconds = abs($seconds);
|
||
|
return sprintf("%d days %02d:%02d:%02d", $seconds/60/60/24,($seconds/60/60)%24,($seconds/60)%60,$seconds%60);
|
||
|
}
|
||
|
|
||
|
?>
|