Have only two pure virtual methods for webrtc::Clock,
`CurrentTime` and `CurrentNtpTime`. Make all other methods non-virtual. Bug: webrtc:11327 Change-Id: I391d9eaec1ba27ec4f8e1901498c68c28a7ec4ff Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219466 Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Paul Hallak <phallak@google.com> Cr-Commit-Position: refs/heads/master@{#34065}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
8ed1e9336e
commit
0de1ed0244
@ -34,22 +34,13 @@ class RTC_EXPORT Clock {
|
||||
virtual ~Clock() {}
|
||||
|
||||
// Return a timestamp relative to an unspecified epoch.
|
||||
// TODO(bugs.webrtc.org/11327): Make this a pure virtual function.
|
||||
virtual Timestamp CurrentTime() {
|
||||
return Timestamp::Micros(TimeInMicroseconds());
|
||||
}
|
||||
|
||||
// TODO(bugs.webrtc.org/11327): Make the following two methods non-virtual
|
||||
// or completely remove them.
|
||||
virtual int64_t TimeInMilliseconds() { return CurrentTime().ms(); }
|
||||
virtual int64_t TimeInMicroseconds() { return CurrentTime().us(); }
|
||||
virtual Timestamp CurrentTime() = 0;
|
||||
int64_t TimeInMilliseconds() { return CurrentTime().ms(); }
|
||||
int64_t TimeInMicroseconds() { return CurrentTime().us(); }
|
||||
|
||||
// Retrieve an NTP absolute timestamp (with an epoch of Jan 1, 1900).
|
||||
virtual NtpTime CurrentNtpTime() = 0;
|
||||
|
||||
// TODO(bugs.webrtc.org/11327): Make the following method non-virtual
|
||||
// or completely remove it.
|
||||
virtual int64_t CurrentNtpInMilliseconds() { return CurrentNtpTime().ToMs(); }
|
||||
int64_t CurrentNtpInMilliseconds() { return CurrentNtpTime().ToMs(); }
|
||||
|
||||
// Returns an instance of the real-time system clock implementation.
|
||||
static Clock* GetRealTimeClock();
|
||||
|
@ -42,8 +42,5 @@ NtpTime DriftingClock::CurrentNtpTime() {
|
||||
return NtpTime(total_fractions);
|
||||
}
|
||||
|
||||
int64_t DriftingClock::CurrentNtpInMilliseconds() {
|
||||
return clock_->CurrentNtpInMilliseconds() + Drift().ms();
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
|
@ -32,7 +32,6 @@ class DriftingClock : public Clock {
|
||||
|
||||
Timestamp CurrentTime() override;
|
||||
NtpTime CurrentNtpTime() override;
|
||||
int64_t CurrentNtpInMilliseconds() override;
|
||||
|
||||
private:
|
||||
TimeDelta Drift() const;
|
||||
|
Reference in New Issue
Block a user