<?xml version="1.0" encoding="windows-1252"?>
<node id="1021312" title="Module to calculate ETA" created="2013-03-01 13:13:15" updated="2013-03-01 13:13:15">
<type id="115">
perlquestion</type>
<author id="867441">
bessarabov</author>
<data>
<field name="doctext">
&lt;h1&gt;Module to calculate ETA&lt;/h1&gt;

&lt;p&gt;I have a task that I'm solving. There is a web page that shows the progress of some long lasting process. The process consists of bunch of small tasks. I need to calculate estimated time of process accomplishment.&lt;/p&gt;

&lt;p&gt;This sound pretty easy. I have start time, I know the number of small tasks that would be done. After complition each small task I can use the simple formula to calculate ETA:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;estimated_time = number_of_tasks_left * ( ( current_time - start_time ) / number_of_tasks_done )
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;But I can't imagine that I'm the first who needs such a thing. I've tried to find CPAN module that can solve this kind of problem, but I found noting.&lt;/p&gt;

&lt;p&gt;Actually there is a great module &lt;a href="https://metacpan.org/module/Term::ProgressBar"&gt;Term::ProgressBar&lt;/a&gt; that calculated ETA.  I use this module in my console scripts and I'm supper happy with it, but I need to calculate ETA and output it on a web page, and for this task this module doesn't suit.&lt;/p&gt;

&lt;p&gt;Actually I have written a draft of module Time::ETA that will solve my problem (you can see the &lt;a href="https://github.com/bessarabov/Time-ETA/blob/master/examples/simple.pl"&gt;working example&lt;/a&gt;). But I can't believe that there is no module for this purpose on CPAN.&lt;/p&gt;

&lt;p&gt;My question — is there some CPAN module that can help me solve my task, or I should complete Time::ETA and upload it to CPAN?&lt;/p&gt;

&lt;p&gt;&lt;b&gt;UPDATE&lt;/b&gt;: I've created and released module &lt;a href="https://metacpan.org/module/Time::ETA"&gt;Time::ETA&lt;/a&gt;&lt;/p&gt;
</field>
</data>
</node>
