Commit c59e2ab8b67d0023ae618e4e6dca2fdf5b312df2

Con Kolivas 2011-07-11T22:57:17

Avoid possible 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 aad34ea..1cfc7fc 100644
--- a/main.c
+++ b/main.c
@@ -1010,7 +1010,7 @@ static void hashmeter(int thr_id, struct timeval *diff,
 	khashes = hashes_done / 1000.0;
 	secs = (double)diff->tv_sec + ((double)diff->tv_usec / 1000000.0);
 
-	if (thr_id >= 0) {
+	if (thr_id >= 0 && secs) {
 		/* So we can call hashmeter from a non worker thread */
 		struct cgpu_info *cgpu = thr_info[thr_id].cgpu;