shithub: orca

Download patch

ref: f56fe8eac7cdbff993a82e4f352587bec492c11c
parent: 2c9c2ed710ed586b58d0f9958fdde32146733aec
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Tue Feb 25 05:36:52 EST 2020

plan9: nanosec: remove wrap around, it doesn't make sense

--- a/plan9.c
+++ b/plan9.c
@@ -650,12 +650,12 @@
 			e = tmp;
 			for (i = 0; i < 3; i++)
 				strtoll(e, &e, 10);
-			fasthz = strtoll(e, nil, 10);
-			if (fasthz < 1)
+			if ((fasthz = strtoll(e, nil, 10)) < 1)
 				fasthz = ~0ULL;
-			close(f);
-			cycles(&xstart);
+			else
+				cycles(&xstart);
 		}
+		close(f);
 		if (fasthz == ~0ULL) {
 			fprint(2, "couldn't get fasthz, falling back to nsec()\n");
 			fprint(2, "you might want to disable aux/timesync\n");
@@ -664,10 +664,6 @@
 		}
 	}
 	cycles(&x);
-	if (x < xstart) { /* wrap around */
-		x += 0 - xstart;
-		xstart = 0;
-	}
 	x -= xstart;
 
 	for (div = 1000000000ULL; x < 0x1999999999999999ULL && div > 1 ; div /= 10ULL, x *= 10ULL);