Use 1000 as multiplier for Mbit/s and kbit/s

Speedtest.net defines Mbit/s and kbit/s using 1000 as multiplier, <https://support.speedtest.net/entries/21057567-What-do-mbps-and-kbps-mean->.
This commit is contained in:
Mihai Capotă 2013-04-15 14:03:10 +02:00
parent 11fb59d6ae
commit 1df0cf239f
2 changed files with 10 additions and 10 deletions

View File

@ -352,9 +352,9 @@ def speedtest():
dlspeed = downloadSpeed(urls, args.simple) dlspeed = downloadSpeed(urls, args.simple)
if not args.simple: if not args.simple:
print print
print 'Download: %0.2f Mbit/s' % ((dlspeed / 1024 / 1024) * 8) print 'Download: %0.2f Mbit/s' % ((dlspeed / 1000 / 1000) * 8)
sizesizes = [int(.25 * 1024 * 1024), int(.5 * 1024 * 1024)] sizesizes = [int(.25 * 1000 * 1000), int(.5 * 1000 * 1000)]
sizes = [] sizes = []
for size in sizesizes: for size in sizesizes:
for i in xrange(0, 25): for i in xrange(0, 25):
@ -364,12 +364,12 @@ def speedtest():
ulspeed = uploadSpeed(best['url'], sizes, args.simple) ulspeed = uploadSpeed(best['url'], sizes, args.simple)
if not args.simple: if not args.simple:
print print
print 'Upload: %0.2f Mbit/s' % ((ulspeed / 1024 / 1024) * 8) print 'Upload: %0.2f Mbit/s' % ((ulspeed / 1000 / 1000) * 8)
if args.share: if args.share:
dlspeedk = int(round((dlspeed / 1024) * 8, 0)) dlspeedk = int(round((dlspeed / 1000) * 8, 0))
ping = int(round(best['latency'], 0)) ping = int(round(best['latency'], 0))
ulspeedk = int(round((ulspeed / 1024) * 8, 0)) ulspeedk = int(round((ulspeed / 1000) * 8, 0))
apiData = [ apiData = [
'download=%s' % dlspeedk, 'download=%s' % dlspeedk,

View File

@ -329,9 +329,9 @@ def speedtest():
dlspeed = downloadSpeed(urls, args.simple) dlspeed = downloadSpeed(urls, args.simple)
if not args.simple: if not args.simple:
print() print()
print('Download: %0.2f Mbit/s' % ((dlspeed / 1024 / 1024) * 8)) print('Download: %0.2f Mbit/s' % ((dlspeed / 1000 / 1000) * 8))
sizesizes = [int(.25 * 1024 * 1024), int(.5 * 1024 * 1024)] sizesizes = [int(.25 * 1000 * 1000), int(.5 * 1000 * 1000)]
sizes = [] sizes = []
for size in sizesizes: for size in sizesizes:
for i in range(0, 25): for i in range(0, 25):
@ -341,12 +341,12 @@ def speedtest():
ulspeed = uploadSpeed(best['url'], sizes, args.simple) ulspeed = uploadSpeed(best['url'], sizes, args.simple)
if not args.simple: if not args.simple:
print() print()
print('Upload: %0.2f Mbit/s' % ((ulspeed / 1024 / 1024) * 8)) print('Upload: %0.2f Mbit/s' % ((ulspeed / 1000 / 1000) * 8))
if args.share: if args.share:
dlspeedk = int(round((dlspeed / 1024) * 8, 0)) dlspeedk = int(round((dlspeed / 1000) * 8, 0))
ping = int(round(best['latency'], 0)) ping = int(round(best['latency'], 0))
ulspeedk = int(round((ulspeed / 1024) * 8, 0)) ulspeedk = int(round((ulspeed / 1000) * 8, 0))
apiData = [ apiData = [
'download=%s' % dlspeedk, 'download=%s' % dlspeedk,