Browse Source

php - display the elapsed time of the worker share rate

master
kanoi 9 years ago
parent
commit
e4f244eee6
  1. 20
      pool/page_workers.php

20
pool/page_workers.php

@ -11,9 +11,10 @@ function worktitle($data, $user)
$pg .= '<td class=dr>Shares</td>'; $pg .= '<td class=dr>Shares</td>';
$pg .= "<td class=dr><span class=nb><$r id=srtdiff data-sf=r4>:Diff</span></td>"; $pg .= "<td class=dr><span class=nb><$r id=srtdiff data-sf=r4>:Diff</span></td>";
$pg .= "<td class=dr><span class=nb><$r id=srtshrate data-sf=r5>:Share Rate</span></td>"; $pg .= "<td class=dr><span class=nb><$r id=srtshrate data-sf=r5>:Share Rate</span></td>";
$pg .= "<td class=dr><span class=nb><$r id=srtinv data-sf=r6>:Invalid</span></td>"; $pg .= '<td class=dr>&laquo;Elapsed</td>';
$pg .= "<td class=dr><span class=nb><$r id=srtinv data-sf=r7>:Invalid</span></td>";
$pg .= '<td class=dr>Block %</td>'; $pg .= '<td class=dr>Block %</td>';
$pg .= "<td class=dr><span class=nb><$r id=srtrate data-sf=r8>:Hash</span> Rate</td>"; $pg .= "<td class=dr><span class=nb><$r id=srtrate data-sf=r9>:Hash</span> Rate</td>";
$pg .= "</tr>\n"; $pg .= "</tr>\n";
return $pg; return $pg;
} }
@ -46,9 +47,10 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff,
} }
$all = array(); $all = array();
$count = $ans['rows']; $count = $ans['rows'];
$now = $ans['STAMP'];
for ($i = 0; $i < $count; $i++) for ($i = 0; $i < $count; $i++)
{ {
$lst = $ans['STAMP'] - $ans['w_lastshare:'.$i]; $lst = $now - $ans['w_lastshare:'.$i];
if ($old !== false && $lst > $old) if ($old !== false && $lst > $old)
continue; continue;
@ -74,7 +76,7 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff,
for ($i = 0; $i < $count; $i++) for ($i = 0; $i < $count; $i++)
{ {
$lst = $ans['STAMP'] - $all[$i]['w_lastshare']; $lst = $now - $all[$i]['w_lastshare'];
if ($old !== false && $lst > $old) if ($old !== false && $lst > $old)
continue; continue;
@ -105,9 +107,12 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff,
$acthr = '0'; $acthr = '0';
$acthrv = 0; $acthrv = 0;
$actstt = $all[$i]['w_active_start']; $actstt = $all[$i]['w_active_start'];
if ($actstt > 0) if ($actstt <= 0 || ($now - $actstt) < 0)
$actsin = '&nbsp;';
else
{ {
$elapsed = $ans['STAMP'] - $actstt; $actsin = howmanyhrs($now - $actstt);
$elapsed = $now - $actstt;
if ($elapsed > 0) if ($elapsed > 0)
{ {
$acthrv = $all[$i]['w_active_diffacc'] * $acthrv = $all[$i]['w_active_diffacc'] *
@ -117,6 +122,7 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff,
} }
} }
$pg .= "<td class=dr data-srt=$acthrv>$acthr</td>"; $pg .= "<td class=dr data-srt=$acthrv>$acthr</td>";
$pg .= "<td class=dr>$actsin</td>";
$dinv = $all[$i]['w_diffinv']; $dinv = $all[$i]['w_diffinv'];
$dtot = $dacc + $dinv; $dtot = $dacc + $dinv;
@ -178,7 +184,7 @@ function worktotal($offset, $totshare, $totdiff, $totshrate, $totinvalid,
$pg .= "<td class=dr>$shareacc</td>"; $pg .= "<td class=dr>$shareacc</td>";
$diffacc = number_format($totdiff, 0); $diffacc = number_format($totdiff, 0);
$pg .= "<td class=dr>$diffacc</td>"; $pg .= "<td class=dr>$diffacc</td>";
$pg .= "<td class=dr>$totshrate</td>"; $pg .= "<td class=dr>$totshrate</td><td>&nbsp;</td>";
$dtot = $totdiff + $totinvalid; $dtot = $totdiff + $totinvalid;
if ($dtot > 0) if ($dtot > 0)
$rej = number_format(100.0 * $totinvalid / $dtot, 3); $rej = number_format(100.0 * $totinvalid / $dtot, 3);

Loading…
Cancel
Save