Switch SchedulerClock to std::chrono::steady_clock According to https://en.cppreference.com/w/cpp/chrono/high_resolution_clock, we should prefer steady_clock or system_clock, depending on our needs. We already assert that it is_steady, and we use values of this type as if they *are* from steady_clock. Specifically, android::scheduler::TimePoint, used throughout SurfaceFlinger, inherits from SchedulerClock::time_point. When computing the earliestPresentTime, we use TimePoints (aka a subclass of high_resolution_clock::time_point), but then we assign the result to CompositionRefreshArgs.earliestPresentTime, which is a steady_clock::time_point. Make this consistent by using the recommended type throughout. Test: m Change-Id: I10a3ba4829a60dfc83256cb9fea3736a6c8a0f94
diff --git a/services/surfaceflinger/Scheduler/include/scheduler/Time.h b/services/surfaceflinger/Scheduler/include/scheduler/Time.h index bd4e3c2..ba1459a 100644 --- a/services/surfaceflinger/Scheduler/include/scheduler/Time.h +++ b/services/surfaceflinger/Scheduler/include/scheduler/Time.h
@@ -26,7 +26,7 @@ namespace scheduler { // TODO(b/185535769): Pull Clock.h to libscheduler to reuse this. -using SchedulerClock = std::chrono::high_resolution_clock; +using SchedulerClock = std::chrono::steady_clock; static_assert(SchedulerClock::is_steady); } // namespace scheduler