From: wmorgan Date: Thu, 4 Jan 2007 06:24:39 +0000 (+0000) Subject: fixed percent done display X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=3a876e60755596bc4d7d0e75aff5e891d48354e9;p=sup fixed percent done display git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@173 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- diff --git a/bin/sup-import b/bin/sup-import index c7e5272..3422317 100644 --- a/bin/sup-import +++ b/bin/sup-import @@ -198,9 +198,9 @@ begin end if num % 1000 == 0 && num > 0 elapsed = Time.now - start - pctdone = (offset.to_f - start_offset) / (source.total.to_f - start_offset) - remaining = (source.total.to_f - offset.to_f) * (elapsed.to_f / (offset.to_f - start_offset)) - puts "## #{num} (#{(pctdone * 100.0)}% done) read; #{elapsed.to_time_s} elapsed; est. #{remaining.to_time_s} remaining" + pctdone = source.pct_done + remaining = (100.0 - pctdone) * (elapsed.to_f / pctdone) + puts "## #{num} (#{pctdone}% done) read; #{elapsed.to_time_s} elapsed; est. #{remaining.to_time_s} remaining" end end puts "loaded #{num} messages" unless num == 0