Skip to content

Commit

Permalink
Remove unused approximate_now_usage_counter_
Browse files Browse the repository at this point in the history
  • Loading branch information
jellefoks committed Nov 21, 2024
1 parent 7cbf5ba commit 51415cb
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions net/quic/platform/impl/quic_chromium_clock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
namespace quic {

namespace {
QuicTime approximate_now_{QuicTime::Zero()};
int approximate_now_usage_counter_{0};
QuicTime s_approximate_now{QuicTime::Zero()};
} // namespace

QuicChromiumClock* QuicChromiumClock::GetInstance() {
Expand All @@ -25,26 +24,23 @@ QuicChromiumClock::QuicChromiumClock() = default;
QuicChromiumClock::~QuicChromiumClock() = default;

void QuicChromiumClock::ZeroApproximateNow() {
approximate_now_ = QuicTime::Zero();
approximate_now_usage_counter_ = 0;
s_approximate_now = QuicTime::Zero();
};

QuicTime QuicChromiumClock::ApproximateNow() const {
// At the moment, Chrome does not have a distinct notion of ApproximateNow().
// We should consider implementing this using MessageLoop::recent_time_.
if (approximate_now_.IsInitialized() &&
++approximate_now_usage_counter_ < 16) {
return approximate_now_;
if (s_approximate_now.IsInitialized()) {
return s_approximate_now;
}
return Now();
}

QuicTime QuicChromiumClock::Now() const {
int64_t ticks = (base::TimeTicks::Now() - base::TimeTicks()).InMicroseconds();
DCHECK_GE(ticks, 0);
approximate_now_ = CreateTimeFromMicroseconds(ticks);
approximate_now_usage_counter_ = 0;
return approximate_now_;
s_approximate_now = CreateTimeFromMicroseconds(ticks);
return s_approximate_now;
}

QuicWallTime QuicChromiumClock::WallNow() const {
Expand Down

0 comments on commit 51415cb

Please sign in to comment.