Re: download time calculator
So, there are few simple calculations I think. By the way what you have done up to now.
Re: download time calculator
It sounds like you could use a method called "dimensional analysis" to help making some of your formulas correctly.
Here's an example. Say I'm given the size of a file in bytes and a download rate in KB/second, and I want to know how long it will take to finish the download. Since you know that the time it takes to finish the download depends only on the total file size and the download rate, you want to combine the download rate and total file size in some mathematical way that gives the proper dimensions (or units) of the time it takes to finish the download.
Algebraically, download time = (file size)^n * (download rate)^m for some exponents n and m. Now this sounds complicated, but to be honest it's not after you've looked at an example or two.
You know download time is in seconds, file size in bytes, and download rate in KB/second or 1000 bytes/second. There's a good reason for this (that I won't get into), but all units must be the same--that is, you can't mix bytes and kilobytes. So before you apply this dimensional analysis, you have to convert the download rate from KB/second to bytes/second.
Anyway, here are the unts from the above algebraic equation: seconds = (bytes)^n * (bytes/second)^m. To get the "second" out of the denominator, m MUST be -1 (since negative exponents flip fractions). However, if m is -1, then there is a "bytes" in the denominator, which will need to be cancelled out by the "bytes" from the file size, so n MUST be 1.
Thus, download time = (file size)^1 * (download rate {in bytes/second
})^-1, or download time = file size/download rate {in bytes/second}.
This actually works, too. Take the file size to be 1000 bytes, and the download rate to be 1 KB/sec (1000 bytes/sec). Clearly, it should take 1 second to download. The formula says it will take 1000 bytes / (1000 bytes/sec) or 1000 bytes*sec/1000 bytes = 1 sec when simplified, as expected. Similarly, if the download rate is instead 2 KB/sec (2000 bytes/sec), download time = 1000 bytes*sec / 2000 bytes = 0.5 seconds, as expected.
I'm pretty sure that online articles could explain this better than I have, since this seems really obtuse as I reread it. After a while I'm sure it'll become simpl. In any case, good luck with your project :)