summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:54:50 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:54:50 +0000
commit31a0531ddea0f1737b607cde4ae40c22493bf72c (patch)
treeaa6aeddf0346ee2a426b61a582d1c8dcd1059282 /apt-pkg
parentc98b1307f0e9c1712b8e36b825724966d9d40eec (diff)
mips and cps changes
Author: jgg Date: 1999-10-16 19:53:18 GMT mips and cps changes
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire.cc20
1 files changed, 6 insertions, 14 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 842f2e31a..99dacf5be 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.38 1999/07/30 05:36:52 jgg Exp $
+// $Id: acquire.cc,v 1.39 1999/10/16 19:53:18 jgg Exp $
/* ######################################################################
Acquire - File Acquiration
@@ -793,24 +793,16 @@ void pkgAcquireStatus::Stop()
struct timeval NewTime;
gettimeofday(&NewTime,0);
- // Compute the delta time with full accuracy
- long usdiff = NewTime.tv_usec - StartTime.tv_usec;
- long sdiff = NewTime.tv_sec - StartTime.tv_sec;
+ double Delta = NewTime.tv_sec - StartTime.tv_sec +
+ (NewTime.tv_usec - StartTime.tv_usec)/1000000.0;
- // Borrow
- if (usdiff < 0)
- {
- usdiff += 1000000;
- sdiff--;
- }
-
// Compute the CPS value
- if (sdiff == 0 && usdiff == 0)
+ if (Delta < 0.01)
CurrentCPS = 0;
else
- CurrentCPS = FetchedBytes/(sdiff + usdiff/1000000.0);
+ CurrentCPS = FetchedBytes/Delta;
LastBytes = CurrentBytes;
- ElapsedTime = sdiff;
+ ElapsedTime = (unsigned int)Delta;
}
/*}}}*/
// AcquireStatus::Fetched - Called when a byte set has been fetched /*{{{*/