Alex Rivera | Logout

Calculate Time Remaining

Asked 2009-01-23T15:43:03.817
69

What's a good algorithm for determining the remaining time for something to complete? I know how many total lines there are, and how many have completed already, how should I estimate the time remaining?

Edit
Report

2 Answers

2

It depends greatly on what the "something" is. If you can assume that the amount of time to process each line is similar, you can do a simple calculation:

TimePerLine = Elapsed / LinesProcessed
TotalTime = TimePerLine * TotalLines
TimeRemaining = TotalTime - LinesRemaining * TimePerLine
answered 2009-01-23T15:47:11.687
0

If you know the percentage completed, and you can simply assume that the time scales linearly, something like

timeLeft = timeSoFar * (1/Percentage)

might work.

answered 2009-01-23T15:46:03.390

Your Answer