What are some good algorithms to calculate the time remaining of downloads? I have an app that may have a bunch of downloads at the same time (with max concurrent run limit), and I want to display an estimate of how much time left. The cheap way is I can easily assume the speed will be (bytes downloaded so far/ time took so far) and compute that against how much bytes are left. I can update this information every 2~3 seconds. The thing is I would like to know what are some better ways?

that's a tough one, simply because the bandwidth can vary so much depending on network load. The two most popular ways: a) Take the file size remaining, and divide by the current download speed. b) Take the file size remaining, and divide by "average" speed as weighted by the time. (if you did 100KB/sec for 60 seconds, and 150KB/sec you averaged ((100*60+150*20)/(60+20))= 112.5 KB/sec average. Overall, method "B" is the most common.

I like (Total Data - Downloaded Data) / (Downloaded Data / Elapsed Time). Example: (50MB - 25MB) / (25MB / 300s) = 25MB / .0833MB/s = 300s It's the same as Method B described by Jolly, it just doesn't perform the weighted-average calculation separately. Makes the equation simpler.

I was using the easy way already. Is there any source that analyzes how much better is the method that uses weighted average over only recent transmission (instead of speed so far), compare to the easy method in the long run?