facebookarchive / network-connection-class

Listen to current network traffic in the app and categorize the quality of the network.
Other
3.18k stars 515 forks source link

[Question] addBandwidth() calculations done in bits/ms but getDownloadKBitsPerSecond()? #14

Closed entrpn closed 8 years ago

entrpn commented 8 years ago

When calling addBandwidth(), the calculations are done in bits/ms, but the getter is named getDownloadKBitsPerSecond(). Meaning it returns kpbs. Is that right? It seems to me that this bandwidth average is actually bits/ms? Thanks.

entrpn commented 8 years ago

Never mind. After looking more at the code, this method name is correct.

In case someone else is confused by this, why it works:

mValue (bits/ms) * (1000 ms / 1 second) * (1Kb/1000 bits) = mValue (Kb/s)

YodaEmbedding commented 4 years ago

Well, that's confusing since:

KB == 1024
kB == 1000

...Perhaps that should have been documented?