From 66b305f86fdee1c27edcb39f299b052c87d2d82e Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 16 Sep 2022 20:00:30 -0700 Subject: typecast time_t and suseconds_t from std::chrono This fixes build on some architectures like mips progress.cc:125:31: error: non-constant-expression cannot be narrowed from type 'std::chrono::duration::rep' (aka 'long long') to '__time_t' (aka 'long') in initializer list [-Wc++11-narrowing] struct timeval NowTime = { Now_sec.count(), Now_usec.count() }; Signed-off-by: Khem Raj --- apt-pkg/contrib/progress.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/contrib/progress.cc') 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(Now); auto const Now_usec = std::chrono::duration_cast(Now - Now_sec); - struct timeval NowTime = { Now_sec.count(), Now_usec.count() }; + struct timeval NowTime = { static_cast(Now_sec.count()), static_cast(Now_usec.count()) }; std::chrono::duration Delta = std::chrono::seconds(NowTime.tv_sec - LastTime.tv_sec) + -- cgit v1.2.3-70-g09d2