From e4f244eee6b7d22ae4f6a9a230df5ade02bafe97 Mon Sep 17 00:00:00 2001 From: kanoi Date: Sun, 20 Sep 2015 14:37:45 +1000 Subject: [PATCH] php - display the elapsed time of the worker share rate --- pool/page_workers.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/pool/page_workers.php b/pool/page_workers.php index 07987311..adf5ebf0 100644 --- a/pool/page_workers.php +++ b/pool/page_workers.php @@ -11,9 +11,10 @@ function worktitle($data, $user) $pg .= 'Shares'; $pg .= "<$r id=srtdiff data-sf=r4>:Diff"; $pg .= "<$r id=srtshrate data-sf=r5>:Share Rate"; - $pg .= "<$r id=srtinv data-sf=r6>:Invalid"; + $pg .= '«Elapsed'; + $pg .= "<$r id=srtinv data-sf=r7>:Invalid"; $pg .= 'Block %'; - $pg .= "<$r id=srtrate data-sf=r8>:Hash Rate"; + $pg .= "<$r id=srtrate data-sf=r9>:Hash Rate"; $pg .= "\n"; return $pg; } @@ -46,9 +47,10 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff, } $all = array(); $count = $ans['rows']; + $now = $ans['STAMP']; for ($i = 0; $i < $count; $i++) { - $lst = $ans['STAMP'] - $ans['w_lastshare:'.$i]; + $lst = $now - $ans['w_lastshare:'.$i]; if ($old !== false && $lst > $old) continue; @@ -74,7 +76,7 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff, for ($i = 0; $i < $count; $i++) { - $lst = $ans['STAMP'] - $all[$i]['w_lastshare']; + $lst = $now - $all[$i]['w_lastshare']; if ($old !== false && $lst > $old) continue; @@ -105,9 +107,12 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff, $acthr = '0'; $acthrv = 0; $actstt = $all[$i]['w_active_start']; - if ($actstt > 0) + if ($actstt <= 0 || ($now - $actstt) < 0) + $actsin = ' '; + else { - $elapsed = $ans['STAMP'] - $actstt; + $actsin = howmanyhrs($now - $actstt); + $elapsed = $now - $actstt; if ($elapsed > 0) { $acthrv = $all[$i]['w_active_diffacc'] * @@ -117,6 +122,7 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff, } } $pg .= "$acthr"; + $pg .= "$actsin"; $dinv = $all[$i]['w_diffinv']; $dtot = $dacc + $dinv; @@ -178,7 +184,7 @@ function worktotal($offset, $totshare, $totdiff, $totshrate, $totinvalid, $pg .= "$shareacc"; $diffacc = number_format($totdiff, 0); $pg .= "$diffacc"; - $pg .= "$totshrate"; + $pg .= "$totshrate "; $dtot = $totdiff + $totinvalid; if ($dtot > 0) $rej = number_format(100.0 * $totinvalid / $dtot, 3);