diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:53:59 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:53:59 +0000 |
commit | aa0e1101d75e6b61d63dc486caa0ab32a45b024f (patch) | |
tree | 883395c1302ad82ec50786dd2c5e9f71ddc1980e /apt-pkg/acquire.cc | |
parent | 314037ba995328f4ac1026bbfb2125af6224248c (diff) |
Fixed some bugs in the progress reporting
Author: jgg
Date: 1999-06-06 06:58:36 GMT
Fixed some bugs in the progress reporting
Diffstat (limited to 'apt-pkg/acquire.cc')
-rw-r--r-- | apt-pkg/acquire.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 306512436..e197037db 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire.cc,v 1.34 1999/05/24 03:39:37 jgg Exp $ +// $Id: acquire.cc,v 1.35 1999/06/06 06:58:36 jgg Exp $ /* ###################################################################### Acquire - File Acquiration @@ -704,11 +704,20 @@ void pkgAcquireStatus::Pulse(pkgAcquire *Owner) } // Compute the current completion + unsigned long ResumeSize = 0; for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0; I = Owner->WorkerStep(I)) if (I->CurrentItem != 0 && I->CurrentItem->Owner->Complete == false) - CurrentBytes += I->CurrentSize - I->ResumePoint; - + { + CurrentBytes += I->CurrentSize; + ResumeSize += I->ResumePoint; + + // Files with unknown size always have 100% completion + if (I->CurrentItem->Owner->FileSize == 0 && + I->CurrentItem->Owner->Complete == false) + TotalBytes += I->CurrentSize; + } + // Normalize the figures and account for unknown size downloads if (TotalBytes <= 0) TotalBytes = 1; @@ -728,8 +737,8 @@ void pkgAcquireStatus::Pulse(pkgAcquire *Owner) if (Delta < 0.01) CurrentCPS = 0; else - CurrentCPS = (CurrentBytes - LastBytes)/Delta; - LastBytes = CurrentBytes; + CurrentCPS = ((CurrentBytes - ResumeSize) - LastBytes)/Delta; + LastBytes = CurrentBytes - ResumeSize; ElapsedTime = (unsigned long)Delta; Time = NewTime; } |