diff options
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/acquire.cc | 4 | ||||
-rw-r--r-- | apt-pkg/contrib/progress.cc | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 100ccde32..dd0624ad6 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -53,11 +53,11 @@ using namespace std; // helper to convert time_point to a timeval -static struct timeval SteadyDurationToTimeVal(std::chrono::steady_clock::duration Time) +constexpr struct timeval SteadyDurationToTimeVal(std::chrono::steady_clock::duration Time) { auto const Time_sec = std::chrono::duration_cast<std::chrono::seconds>(Time); auto const Time_usec = std::chrono::duration_cast<std::chrono::microseconds>(Time - Time_sec); - return {Time_sec.count(), Time_usec.count()}; + return timeval{static_cast<time_t>(Time_sec.count()), static_cast<suseconds_t>(Time_usec.count())}; } std::string pkgAcquire::URIEncode(std::string const &part) /*{{{*/ diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc index 03f88d4ce..eb688b9a2 100644 --- a/apt-pkg/contrib/progress.cc +++ b/apt-pkg/contrib/progress.cc @@ -122,7 +122,7 @@ bool OpProgress::CheckChange(float Interval) auto const Now = std::chrono::steady_clock::now().time_since_epoch(); auto const Now_sec = std::chrono::duration_cast<std::chrono::seconds>(Now); auto const Now_usec = std::chrono::duration_cast<std::chrono::microseconds>(Now - Now_sec); - struct timeval NowTime = { Now_sec.count(), Now_usec.count() }; + struct timeval NowTime = { static_cast<time_t>(Now_sec.count()), static_cast<suseconds_t>(Now_usec.count()) }; std::chrono::duration<decltype(Interval)> Delta = std::chrono::seconds(NowTime.tv_sec - LastTime.tv_sec) + |