[Patch] Feature Update (Elapsed and Remaining Time) and Bug Fix for Console_ProgressBar
| From: | Alan Pinstein | Date: | Mon, 17 Apr 2006 01:46:16 +0000 |
| Subject: | [Patch] Feature Update (Elapsed and Remaining Time) and Bug Fix for Console_ProgressBar | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-42256@lists.php.net to get a copy of this message | ||
Hi all-
Thanks for the excellent CLI progress bar for PHP! I am using it in a long-lasting import script.
I added a couple of output options:
%elapsed% The elapsed time in HH:MM:SS format.
%estimate_remaining% An estimate of the time remaining in HH:MM:SS format. Based on a moving average.
The estimate remaining is calculated through a moving average algorithm of the last 5 measurements so that it "corrects" itself over time. There's obviously no perfect way to estimate time remaining, but at least it's a bit more realistic than using a average for the whole run.
Also I fixed a bug with some chars not being erased in ANSI mode if the repaint str is shorter than the previous display. This fixes the bug I just reported: http://pear.php.net/bugs/7407
All the code keeps the same style as the original and is fully commented as well.
Enjoy!
Alan Pinstein