|Think about Loose Coupling|
Module to calculate ETA
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.
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:
estimated_time = number_of_tasks_left * ( ( current_time - start_time ) / number_of_tasks_done )
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.
Actually there is a great module Term::ProgressBar 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.
Actually I have written a draft of module Time::ETA that will solve my problem (you can see the working example). But I can't believe that there is no module for this purpose on CPAN.
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?
UPDATE: I've created and released module Time::ETA