Skip to content
Snippets Groups Projects
Commit fa7675d0 authored by Graham Cole's avatar Graham Cole
Browse files

difficult when I can't test this till after I've committed... another stab at parsing mw idle times

parent 5fc2e199
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ function parseIdleTime($idletime) {
$seconds = $idlearray[0];
}
return ($hours * 3600) + ($minutes * 60) + $seconds;
return (intval($hours * 3600)) + (intval($minutes) * 60) + intval($seconds);
}
......@@ -26,6 +26,7 @@ function compare_idletime($a, $b) {
exec("/usr/bin/mw -who", $wholist, $ret);
$people = array();
$idlers = array();
foreach ($wholist as $person) {
$pid = strtok($person, " ");
if ($pid == "" || $pid == "Name" || substr($pid,0,5)=="-----") continue;
......@@ -34,6 +35,7 @@ foreach ($wholist as $person) {
"idle" => trim(substr($person, 18, 6)),
"idleseconds" => parseIdleTime(trim(substr($person, 18, 6))),
"what" => substr($person,25));
if ($person['idleseconds'] > 3600) {
$idlers[] = $person;
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment