The current (r9481) code to estimate completion time works like this:
elapsed_time = now - begin est_total_time = elapsed_time / percent_done est_remaining_time = est_total_time - elapsed_time
In other words it calculates the current lifetime average completion rate, then assumes that the scan will continue at that rate until the end. This doesn't work well when the completion rate isn't constant. Early results unduly affect later estimates. When a scan slows down as it progresses (a common case), the estimate of completion time will always be sooner than when the scan will actually finish.
In these graphs the black line is the estimated remaining time and the gray line is the actual remaining time.
nmap -v -p- localhost
nmap -v -sU 192.168.0.1
nmap -n -PN -v scanme.nmap.org
nmap -n -PN -v -p- scanme.nmap.org
nmap -n -PN -v -p1-100 scanme.nmap.org/26
Here are revised estimates (r9486) using only the number of completed ports, not counting outstanding probes.
nmap -n -PN -v -p- localhost
nmap -PN -n -v -sU 192.168.0.1
r9506.
nmap -n -PN -v -p- localhost
nmap -n -PN -v -sU 192.168.0.1
nmap -n -PN -v scanme.nmap.org
nmap -n -PN -v -p1-100 scanme.nmap.org/26
nmap -n -PN -v -p- localhost
nmap -n -PN -v -sU 192.168.0.1
nmap -n -PN -v scanme.nmap.org
nmap -n -PN -v -p- scanme.nmap.org
nmap -n -PN -v -p1-100 scanme.nmap.org/26