diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2021-07-27 17:14:23 +0200 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2021-07-28 13:08:35 +0200 |
commit | 51ee79e385d8ccb2f32195cc01f3f9c943197603 (patch) | |
tree | f865ef43fe86eefe406086af30eb241717f5ccec | |
parent | 48a7ece8d0e065240153a85089f544383e16137f (diff) |
Properly convert PulseInterval to timeval
Fix the typo, and use the helper function to convert it, so we
do not end up with 5 seconds encoded as 0s and 5*10^6 microseconds.
-rw-r--r-- | apt-pkg/acquire.cc | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index e97f5e6f3..c3682504f 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -696,7 +696,7 @@ static void CheckDropPrivsMustBeDisabled(pkgAcquire const &Fetcher) if (setgroups(old_gidlist_nr, old_gidlist.get())) _error->FatalE("setgroups", "setgroups %u failed", 0); } -pkgAcquire::RunResult pkgAcquire::Run(int PulseIntervall) +pkgAcquire::RunResult pkgAcquire::Run(int PulseInterval) { _error->PushToStack(); CheckDropPrivsMustBeDisabled(*this); @@ -712,9 +712,7 @@ pkgAcquire::RunResult pkgAcquire::Run(int PulseIntervall) bool WasCancelled = false; // Run till all things have been acquired - struct timeval tv; - tv.tv_sec = 0; - tv.tv_usec = PulseIntervall; + struct timeval tv = SteadyDurationToTimeVal(std::chrono::microseconds(PulseInterval)); while (ToFetch > 0) { fd_set RFds; @@ -773,8 +771,7 @@ pkgAcquire::RunResult pkgAcquire::Run(int PulseIntervall) // Timeout, notify the log class if (Res == 0 || (Log != 0 && Log->Update == true)) { - tv.tv_sec = 0; - tv.tv_usec = PulseIntervall; + tv = SteadyDurationToTimeVal(std::chrono::microseconds(PulseInterval)); for (Worker *I = Workers; I != 0; I = I->NextAcquire) I->Pulse(); |