-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
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.