Commit 413e6b864545538a6db780bc7b330e227800dd33

Con Kolivas 2011-07-05T22:08:13

Fix potential divide by zero.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/main.c b/main.c
index 895bcf3..6736b7a 100644
--- a/main.c
+++ b/main.c
@@ -969,7 +969,7 @@ static void *miner_thread(void *userdata)
 		/* adjust max_nonce to meet target cycle time */
 		if (diff.tv_usec > 500000)
 			diff.tv_sec++;
-		if (diff.tv_sec != cycle) {
+		if (diff.tv_sec && diff.tv_sec != cycle) {
 			max64 = work.blk.nonce +
 				((uint64_t)hashes_done * cycle) / diff.tv_sec;
 		} else