summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/srvrec.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/contrib/srvrec.cc')
-rw-r--r--apt-pkg/contrib/srvrec.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/apt-pkg/contrib/srvrec.cc b/apt-pkg/contrib/srvrec.cc
index be159bad9..327e59937 100644
--- a/apt-pkg/contrib/srvrec.cc
+++ b/apt-pkg/contrib/srvrec.cc
@@ -185,7 +185,7 @@ SrvRec PopFromSrvRecs(std::vector<SrvRec> &Recs)
[&I](SrvRec const &J) { return I->priority != J.priority; });
// clock seems random enough.
- I += clock() % std::distance(I, J);
+ I += std::max(static_cast<clock_t>(0), clock()) % std::distance(I, J);
SrvRec const selected = std::move(*I);
Recs.erase(I);