mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
time: For tests, subtract in the right order
This was a bug in the test rather than a bug in the code the test was testing. Use the ternary operator to replace labs. Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
This commit is contained in:
parent
1d4c6079e3
commit
99ee598c9e
@ -122,7 +122,9 @@ static void system_clock_conversions() {
|
|||||||
|
|
||||||
ASSERT_EQ(Clock::to_double(brt), bd);
|
ASSERT_EQ(Clock::to_double(brt), bd);
|
||||||
// Fudge factor
|
// Fudge factor
|
||||||
ASSERT_LT(abs((Clock::from_double(bd) - brt).count()), 30);
|
ASSERT_LT((Clock::from_double(bd) > brt ?
|
||||||
|
Clock::from_double(bd) - brt :
|
||||||
|
brt - Clock::from_double(bd)).count(), 30U);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RealClock, Sanity) {
|
TEST(RealClock, Sanity) {
|
||||||
|
Loading…
Reference in New Issue
Block a user