diff --git a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp index fbc79fa26a..43f5d69467 100644 --- a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp @@ -50,7 +50,7 @@ void RecurrentTimer::registerTimerCallback(int64_t intervalInNano, std::scoped_lock lockGuard(mLock); // Aligns the nextTime to multiply of interval. - int64_t nextTime = ceil(elapsedRealtimeNano() / intervalInNano) * intervalInNano; + int64_t nextTime = ceil(uptimeNanos() / intervalInNano) * intervalInNano; std::unique_ptr info = std::make_unique(); info->callback = callback; @@ -130,7 +130,7 @@ void RecurrentTimer::loop() { } // The first element is the nearest next event. int64_t nextTime = mCallbackQueue[0]->nextTime; - int64_t now = elapsedRealtimeNano(); + int64_t now = uptimeNanos(); if (nextTime > now) { interval = nextTime - now; } else { @@ -148,7 +148,7 @@ void RecurrentTimer::loop() { { ScopedLockAssertion lockAssertion(mLock); - int64_t now = elapsedRealtimeNano(); + int64_t now = uptimeNanos(); while (mCallbackQueue.size() > 0) { int64_t nextTime = mCallbackQueue[0]->nextTime; if (nextTime > now) {