Calculate estimated time in a program
<p>I'm making a program and I want to give to the user information about the estimated times every 1000 elements processed. I'm calculating time in this way:</p>

<ul>
<li>C = elements processed so far</li>
<li>MAX = Max elements to process</li>
<li>Tp = time elapsed</li>
<li>Te = time estimated</li>
</ul>

<p>In theory, the relation between elements processed and elapsed time is equal to the relation between the rest of the elements and the rest of time, so my formula is:</p>

<p>(C/Tp) = (MAX - C)/(Te - Tp)</p>

<p>So I need to solve <strong>Te</strong> by doing:</p>

<p>(Te - Tp) = (MAX - C)Tp/C</p>

<p>And finally:</p>

<p>Te = (MAX - C)Tp/C + Tp</p>

<p>I think that resolution is correct but clearly, operation doesn't tend to 0 as <strong>C</strong> and <strong>Tp</strong> grows, so I'm sure that I'm doing a stupid mistake but I couldn't find.</p>

<p>Some ideas please?</p>
