>
> OK. I have the values of bytesSoFar and bytesTotal. So, how to calculate
the remaining time?
>

Pseudocode here:

--When starting the download, get the time and place that in a variable,
StartTicks = the ticks

--calculate how much of the file is downloaded, (will be a value between 0
and 1), where 1 is the complete file
fraction= bytesSoFar / bytesTotal

--calc how long the download has taken so far
howLongHasGone = the ticks - StartTicks

--calc the estimated time to download all file,
EstimatedTotalTime = howLongHasGone / fraction

--this will be in ticks. and there goes 60 ticks in one sec,

--how long is left then?
TimeLeft = EstimatedTotalTime - howLongHasGone

HTH/Christoffer




[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email [EMAIL 
PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping 
with programming Lingo.  Thanks!]

Reply via email to