Dont show negative seconds

This commit is contained in:
Thomas Lynch
2022-10-03 08:36:30 +11:00
parent c61dd4caa2
commit d61f320ba9

View File

@ -89,7 +89,8 @@ const powFinished = new Promise((resolve, reject) => {
const elapsedSec = Math.floor((Date.now()-start)/1000);
const hps = Math.floor(totalHashes/elapsedSec);
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; }
finished = true;