mIRC Home    About    Download    Register    News    Help

Print Thread
#119357 04/05/05 08:39 PM
Joined: Jan 2005
Posts: 37
S
Scratch Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2005
Posts: 37
Could someone please explain or post an example how I can calculate the ETA of a file download? For example, let's say I have a script that downloads a file from the WWW via sockets, how can I show how many seconds, minutes or hours it will take to finish the download? Is there a formula I can use?

Thanks in advance!

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
RemainingFraction = (filesize - downloadedamount) / filesize
TimeTakenSoFare = (currenttime - starttime)
EstTotalTime = TimeTakenSoFare / (1 - RemainingFraction)
EstTimeRemaining = EstTotalTime * RemainingFraction

I do it in steps like this becuase all of these steps can be nice to be showing in a progress bar etc, only one you might change is RemainingFraction by * by 100 to give Percentage Remaining


Link Copied to Clipboard