Change NtpTime representation to single uint64_t
Add explicit conversions to/from uint64_t
uint64_t is natural type for NtpTime, including wrap on overflow.
BUG=None
Review-Url: https://codereview.webrtc.org/2695683002
Cr-Commit-Position: refs/heads/master@{#16624}
diff --git a/webrtc/system_wrappers/source/ntp_time_unittest.cc b/webrtc/system_wrappers/source/ntp_time_unittest.cc
index fe04471..9a2a926 100644
--- a/webrtc/system_wrappers/source/ntp_time_unittest.cc
+++ b/webrtc/system_wrappers/source/ntp_time_unittest.cc
@@ -54,5 +54,12 @@
EXPECT_EQ(ntp.ToMs(), clock.CurrentNtpInMilliseconds());
}
+TEST(NtpTimeTest, CanExplicitlyConvertToAndFromUint64) {
+ uint64_t untyped_time = 0x123456789;
+ NtpTime time(untyped_time);
+ EXPECT_EQ(untyped_time, static_cast<uint64_t>(time));
+ EXPECT_EQ(NtpTime(0x12345678, 0x90abcdef), NtpTime(0x1234567890abcdef));
+}
+
} // namespace
} // namespace webrtc