1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 15:27:53 +00:00

Fix potential divide by zero.

This commit is contained in:
Con Kolivas 2011-07-05 22:08:13 +10:00
parent 660aabf7f7
commit 413e6b8645

2
main.c
View File

@ -969,7 +969,7 @@ static void *miner_thread(void *userdata)
/* adjust max_nonce to meet target cycle time */ /* adjust max_nonce to meet target cycle time */
if (diff.tv_usec > 500000) if (diff.tv_usec > 500000)
diff.tv_sec++; diff.tv_sec++;
if (diff.tv_sec != cycle) { if (diff.tv_sec && diff.tv_sec != cycle) {
max64 = work.blk.nonce + max64 = work.blk.nonce +
((uint64_t)hashes_done * cycle) / diff.tv_sec; ((uint64_t)hashes_done * cycle) / diff.tv_sec;
} else } else