From a7eb4ea1348c2d1c35e17a2730a1217e75ec455e Mon Sep 17 00:00:00 2001 From: Vincent Woo Date: Mon, 4 Jul 2016 16:28:23 -0700 Subject: [PATCH] Dividing by 1000 can often round straight down to 0 --- speedtest_cli.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/speedtest_cli.py b/speedtest_cli.py index d93d5c3..a624258 100755 --- a/speedtest_cli.py +++ b/speedtest_cli.py @@ -720,7 +720,7 @@ def speedtest(): if not args.simple: print_() print_('Download: %0.2f M%s/s' % - ((dlspeed / 1000 / 1000) * args.units[1], args.units[0])) + ((dlspeed / 1000.0 / 1000.0) * args.units[1], args.units[0])) sizesizes = [int(.25 * 1000 * 1000), int(.5 * 1000 * 1000)] sizes = [] @@ -733,15 +733,15 @@ def speedtest(): if not args.simple: print_() print_('Upload: %0.2f M%s/s' % - ((ulspeed / 1000 / 1000) * args.units[1], args.units[0])) + ((ulspeed / 1000.0 / 1000.0) * args.units[1], args.units[0])) if args.share and args.mini: print_('Cannot generate a speedtest.net share results image while ' 'testing against a Speedtest Mini server') elif args.share: - dlspeedk = int(round((dlspeed / 1000) * 8, 0)) + dlspeedk = int(round((dlspeed / 1000.0) * 8, 0)) ping = int(round(best['latency'], 0)) - ulspeedk = int(round((ulspeed / 1000) * 8, 0)) + ulspeedk = int(round((ulspeed / 1000.0) * 8, 0)) # Build the request to send results back to speedtest.net # We use a list instead of a dict because the API expects parameters