From 54bcf83dada06e5a1bd9fb75db146b90cf77bac8 Mon Sep 17 00:00:00 2001 From: Nelson Chen Date: Sun, 15 Nov 2015 13:35:04 -0800 Subject: [PATCH] Correct average latency calculation in best server determination. Reverts part of commit c1b9a0d. I guess some exploratory or debugging edits made it into the commit. Three samples are run, summed, and divided by six. It should be three. As a result, the latency results were halved. The "best" server was still chosen but the ping time displayed was half of the real average result. --- speedtest_cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/speedtest_cli.py b/speedtest_cli.py index d93d5c3..1c28b4a 100755 --- a/speedtest_cli.py +++ b/speedtest_cli.py @@ -522,7 +522,7 @@ def getBestServer(servers): else: cum.append(3600) h.close() - avg = round((sum(cum) / 6) * 1000, 3) + avg = round((sum(cum) / 3) * 1000, 3) results[avg] = server fastest = sorted(results.keys())[0] best = results[fastest]