From 89c79383e45f9c46951f74e8971fb9fedfe0137c Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Thu, 22 Feb 2018 16:34:50 +0100 Subject: [PATCH] Delete assumption TimeMicrosToNtp can match RealTimeClock Flakiness of the test reveals this assumption doesn't hold and shouldn't be rely on. Currently there is no code that use it. Plans to rely on it silently adjusted. Bug: webrtc:8610 Change-Id: Id24f2a36c8fb188b518f5301c4b278836885d140 Reviewed-on: https://webrtc-review.googlesource.com/56860 Reviewed-by: Niels Moller Commit-Queue: Danil Chapovalov Cr-Commit-Position: refs/heads/master@{#22160} --- modules/rtp_rtcp/source/time_util.h | 4 ++-- modules/rtp_rtcp/source/time_util_unittest.cc | 23 ------------------- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/modules/rtp_rtcp/source/time_util.h b/modules/rtp_rtcp/source/time_util.h index 3e7d1e29f1..672722c07f 100644 --- a/modules/rtp_rtcp/source/time_util.h +++ b/modules/rtp_rtcp/source/time_util.h @@ -20,8 +20,8 @@ namespace webrtc { // Converts time obtained using rtc::TimeMicros to ntp format. // TimeMicrosToNtp guarantees difference of the returned values matches // difference of the passed values. -// As a result TimeMicrosToNtp(rtc::TimeMicros()) doesn't guarantte to match -// system time after first call. +// As a result TimeMicrosToNtp(rtc::TimeMicros()) doesn't guarantee to match +// system time. NtpTime TimeMicrosToNtp(int64_t time_us); // Converts NTP timestamp to RTP timestamp. diff --git a/modules/rtp_rtcp/source/time_util_unittest.cc b/modules/rtp_rtcp/source/time_util_unittest.cc index 25cda491f9..0ff4f7b079 100644 --- a/modules/rtp_rtcp/source/time_util_unittest.cc +++ b/modules/rtp_rtcp/source/time_util_unittest.cc @@ -16,29 +16,6 @@ namespace webrtc { -// Disabled as flake: http://bugs.webrtc.org/8610 -#ifdef WEBRTC_IOS -#define MAYBE_TimeMicrosToNtpMatchRealTimeClockInitially \ - DISABLED_TimeMicrosToNtpMatchRealTimeClockInitially -#else -#define MAYBE_TimeMicrosToNtpMatchRealTimeClockInitially \ - TimeMicrosToNtpMatchRealTimeClockInitially -#endif -TEST(TimeUtilTest, MAYBE_TimeMicrosToNtpMatchRealTimeClockInitially) { - Clock* legacy_clock = Clock::GetRealTimeClock(); - NtpTime before_legacy_time = TimeMicrosToNtp(rtc::TimeMicros()); - NtpTime legacy_time = legacy_clock->CurrentNtpTime(); - NtpTime after_legacy_time = TimeMicrosToNtp(rtc::TimeMicros()); - - // This test will fail once every 136 years, when NtpTime wraparound. - // More often than that, it will fail if system adjust ntp time while test - // is running. - // To mitigate ntp time adjustment and potentional different precisions of - // Clock and TimeMicrosToNtp, relax expectation by a millisecond. - EXPECT_GE(legacy_time.ToMs(), before_legacy_time.ToMs() - 1); - EXPECT_LE(legacy_time.ToMs(), after_legacy_time.ToMs() + 1); -} - TEST(TimeUtilTest, TimeMicrosToNtpDoesntChangeBetweenRuns) { rtc::ScopedFakeClock clock; // TimeMicrosToNtp is not pure: it behave differently between different