Commit f706fef53788a7189dd8792a08a0a23bcab17f9f

Con Kolivas 2013-10-14T20:57:13

Merge branch 'master' of github.com:ckolivas/cgminer

diff --git a/driver-klondike.c b/driver-klondike.c
index 6983465..91e4ca9 100644
--- a/driver-klondike.c
+++ b/driver-klondike.c
@@ -696,18 +696,20 @@ static void klondike_check_nonce(struct cgpu_info *klncgpu, KLIST *kitem)
 			klninfo->delay_count++;
 			klninfo->delay_total += us_diff;
 
-			us_diff = us_tdiff(&(kitem->tv_when), &(klninfo->tv_last_nonce_received));
-			if (klninfo->nonce_count == 0) {
-				klninfo->nonce_min = us_diff;
-				klninfo->nonce_max = us_diff;
-			} else {
-				if (klninfo->nonce_min > us_diff)
+			if (klninfo->nonce_count > 0) {
+				us_diff = us_tdiff(&(kitem->tv_when), &(klninfo->tv_last_nonce_received));
+				if (klninfo->nonce_count == 1) {
 					klninfo->nonce_min = us_diff;
-				if (klninfo->nonce_max < us_diff)
 					klninfo->nonce_max = us_diff;
+				} else {
+					if (klninfo->nonce_min > us_diff)
+						klninfo->nonce_min = us_diff;
+					if (klninfo->nonce_max < us_diff)
+						klninfo->nonce_max = us_diff;
+				}
+				klninfo->nonce_total += us_diff;
 			}
 			klninfo->nonce_count++;
-			klninfo->nonce_total += us_diff;
 
 			memcpy(&(klninfo->tv_last_nonce_received), &(kitem->tv_when),
 				sizeof(klninfo->tv_last_nonce_received));