]> git.cworth.org Git - sup/commitdiff
fixed percent done display
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Thu, 4 Jan 2007 06:24:39 +0000 (06:24 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Thu, 4 Jan 2007 06:24:39 +0000 (06:24 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@173 5c8cc53c-5e98-4d25-b20a-d8db53a31250

bin/sup-import

index c7e52722a733ae7f1e644c74ad103f868a32d145..3422317125823783e9b3d2e27ef86463bdfa7ae5 100644 (file)
@@ -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