mirror of
https://gitgud.io/fatchan/haproxy-protection.git
synced 2025-05-09 02:05:37 +00:00
Dont show negative seconds
This commit is contained in:
@ -89,7 +89,8 @@ const powFinished = new Promise((resolve, reject) => {
|
|||||||
const elapsedSec = Math.floor((Date.now()-start)/1000);
|
const elapsedSec = Math.floor((Date.now()-start)/1000);
|
||||||
const hps = Math.floor(totalHashes/elapsedSec);
|
const hps = Math.floor(totalHashes/elapsedSec);
|
||||||
const requiredSec = Math.floor(eHashes/hps) * 1.5; //estimate 1.5x time
|
const requiredSec = Math.floor(eHashes/hps) * 1.5; //estimate 1.5x time
|
||||||
return updateElem('.powstatus', `Proof-of-work: ${hps}H/s, ~${Math.floor(requiredSec-elapsedSec)}s remaining`);
|
const remainingSec = Math.max(0, Math.floor(requiredSec-elapsedSec)); //dont show negative time
|
||||||
|
return updateElem('.powstatus', `Proof-of-work: ${hps}H/s, ~${remainingSec}s remaining`);
|
||||||
}
|
}
|
||||||
if (finished) { return; }
|
if (finished) { return; }
|
||||||
finished = true;
|
finished = true;
|
||||||
|
Reference in New Issue
Block a user