summaryrefslogtreecommitdiff
path: root/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2023-01-15 14:37:41 -0800
committerLinux Build Service Account <lnxbuild@localhost>2023-01-15 14:37:41 -0800
commit2bc41ae7df3e9f757055dbc9f48d745af725dac0 (patch)
tree142a3767bf6b65065cde85b8917a869ef74c4c6b /automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp
parentf177343e18479a9420a73aa1a1be56cce1714253 (diff)
parent32336a56e5d1852850d84aea35ab584ed6ce84a2 (diff)
Merge 32336a56e5d1852850d84aea35ab584ed6ce84a2 on remote branch
Change-Id: I37ba79726c479d04e9162c56d714be12964d0ad5
Diffstat (limited to 'automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp')
-rw-r--r--automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp
index 8521c4db7c..2eca6b7a17 100644
--- a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp
+++ b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp
@@ -48,7 +48,7 @@ void RecurrentTimer::registerTimerCallback(int64_t intervalInNano,
std::scoped_lock<std::mutex> 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<CallbackInfo> info = std::make_unique<CallbackInfo>();
info->callback = callback;
@@ -128,7 +128,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 {
@@ -146,7 +146,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) {