Skip to content

quiche: add support for QuicClock::ApproximateNow  #7177

@danzh2010

Description

@danzh2010

QuicClock::ApproximateNow() provides a cheaper way to get current time than calling std::steady_clock::now(). It returns a slightly lagged timestamp which is usually within acceptable range. But currently EnvoyQuicClock implements it in the same way as Now() which does call std::steady_clock::now().

A typically implementation is to store a timestamp in each event loop and return that timestamp for ApproximateNow(). In Envoy LibeventScheduler::prepare_time_|check_time_ can serve this purpose. Since DispatcherImpl owns libeventScheduler, we can add an interface Dispatcher::getSchedulerPrepareTime() to return LibeventScheduler::prepare_time_. And instead of referencing TimeSystem in QuicClock, we can change it to reference a Dispatcher which also provides TimeSource interface.

Metadata

Metadata

Assignees

Labels

area/quicstalestalebot believes this issue/PR has not been touched recently

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions