Browse Source

php - payout help number formatting

master
kanoi 9 years ago
parent
commit
3ae73463fe
  1. 12
      pool/base.php
  2. 8
      pool/page_payout.php

12
pool/base.php

@ -121,15 +121,27 @@ function howmanyhrs($tot, $days = false, $dh = false)
if ($dh == true) if ($dh == true)
{ {
if ($min >= 30) if ($min >= 30)
{
$hr++; $hr++;
if ($hr == 24)
{
$days++;
$hr = 0;
}
}
$ds = ''; $ds = '';
if ($dy != 1) if ($dy != 1)
$ds = 's'; $ds = 's';
if ($hr == 0)
$des = "${dy}day$ds";
else
{
$hs = ''; $hs = '';
if ($hr != 1) if ($hr != 1)
$hs = 's'; $hs = 's';
$des = "${dy}day$ds ${hr}hr$hs"; $des = "${dy}day$ds ${hr}hr$hs";
} }
}
else else
$des = $dy.'d '.$hr.'hr '.$min.'m '.$sec.'s'; $des = $dy.'d '.$hr.'hr '.$min.'m '.$sec.'s';
} }

8
pool/page_payout.php

@ -15,14 +15,14 @@ function dopayout($data, $user)
$nd = $data['info']['currndiff']; $nd = $data['info']['currndiff'];
$nv = number_format($nd, 1); $nv = number_format($nd, 1);
$nvx = '<b>'.number_format($N*$nd, 1).'</b>'; $nvx = '<b>'.number_format($N*$nd, 1).'</b>';
$phr = $data['info']['p_hashrate24hr']; $pd = $data['info']['p_hashrate24hr'];
$hr = 'is <b>?</b>'; $hr = 'is <b>?</b>';
$hrt = '<b>?</b>'; $hrt = '<b>?</b>';
if ($phr != '?' && $phr != '' && $phr > 0) if ($pd != '?' && $pd != '' && $pd > 0)
{ {
$hr = 'for the last day is <b>'.dsprate($phr).'</b>'; $hr = 'for the last day is roughly <b>'.siprefmt($pd,2).'Hs</b>';
if ($nd > 0) if ($nd > 0)
$hrt = '<b>'.howmanyhrs($nd / ($phr / pow(2,32)), true, true).'</b>'; $hrt = '<b>'.howmanyhrs($nd * $N / ($pd / pow(2,32)), true, true).'</b>';
} }
$pg = "<h1>Payouts</h1> $pg = "<h1>Payouts</h1>

Loading…
Cancel
Save