bpo-35513, unittest: TextTestRunner uses time.perf_counter() (GH-11180)
TextTestRunner of unittest.runner now uses time.perf_counter() rather
than time.time() to measure the execution time of a test: time.time()
can go backwards, whereas time.perf_counter() is monotonic.
Similar change made in libregrtest, pprint and random.
diff --git a/Lib/random.py b/Lib/random.py
index 03c058a..9c2904c 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -740,14 +740,14 @@
sqsum = 0.0
smallest = 1e10
largest = -1e10
- t0 = time.time()
+ t0 = time.perf_counter()
for i in range(n):
x = func(*args)
total += x
sqsum = sqsum + x*x
smallest = min(x, smallest)
largest = max(x, largest)
- t1 = time.time()
+ t1 = time.perf_counter()
print(round(t1-t0, 3), 'sec,', end=' ')
avg = total/n
stddev = _sqrt(sqsum/n - avg*avg)