# Calculate Progress Time Remaining?

Discussion in 'OT Technology' started by Dio Seijuro, Nov 16, 2007.

1. ### Dio SeijuroNew Member

Joined:
Oct 18, 2006
Messages:
898
0
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?

2. ### P07r0457New Member

Joined:
Sep 20, 2004
Messages:
28,491
0
Location:
Southern Oregon
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.

3. ### deusexaetheraOT Supporter

Joined:
Jan 27, 2005
Messages:
19,712
0

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.

4. ### DneprGuest

I would say method "A" is actually most common.

Joined:
Oct 18, 2006
Messages:
898