From: Kefu Chai Date: Sat, 20 Feb 2016 07:27:07 +0000 (+0800) Subject: test/time: no need to abs(uint64_t) for comparing X-Git-Tag: v10.1.0~150^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=da0f6608dd6cc3356e727e739575f496c2b6a590;p=ceph.git test/time: no need to abs(uint64_t) for comparing fixes ``` /home/kefu/dev/ceph/src/test/common/test_time.cc: In instantiation of ‘void system_clock_conversions() [with Clock = ceph::time_detail::real_clock]’: /home/kefu/dev/ceph/src/test/common/test_time.cc:134:40: required from here /home/kefu/dev/ceph/src/test/common/test_time.cc:125:169: error: call of overloaded ‘abs(std::chrono::duration >::rep)’ is ambiguous ASSERT_LT(abs((Clock::from_double(bd) - brt).count()), 30); ``` as std::abs() does not have a specialization for unsigned types, and we are using uint64_t as the `typename duration<>::rep`. Signed-off-by: Kefu Chai --- diff --git a/src/test/common/test_time.cc b/src/test/common/test_time.cc index 2e6ad4bbcbd2..0f6fc2090a71 100644 --- a/src/test/common/test_time.cc +++ b/src/test/common/test_time.cc @@ -122,7 +122,7 @@ static void system_clock_conversions() { ASSERT_EQ(Clock::to_double(brt), bd); // Fudge factor - ASSERT_LT(abs((Clock::from_double(bd) - brt).count()), 30); + ASSERT_LT((Clock::from_double(bd) - brt).count(), 30U); } TEST(RealClock, Sanity) {