From fa7675d08fbba9052ad593d9fb59d45537446521 Mon Sep 17 00:00:00 2001 From: Graham Cole <chckens@sucs.org> Date: Wed, 13 Feb 2008 20:54:14 +0000 Subject: [PATCH] difficult when I can't test this till after I've committed... another stab at parsing mw idle times --- components/milliways.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/milliways.php b/components/milliways.php index 7ca7213..d4e3379 100644 --- a/components/milliways.php +++ b/components/milliways.php @@ -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 { -- GitLab