cpuminer: avoid division by zero.

This commit is contained in:
Christopher Jeffrey 2017-08-14 17:51:40 -07:00
parent 453bc82a8d
commit 09a2dc0f55
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -547,7 +547,7 @@ CPUJob.prototype.getHashes = function getHashes(nonce) {
CPUJob.prototype.getRate = function getRate(nonce) {
const hashes = this.getHashes(nonce);
const seconds = util.now() - this.start;
return Math.floor(hashes / seconds);
return Math.floor(hashes / Math.max(1, seconds));
};
/**