From 2c817bdc5851629cb039ebcd26f46d9167adbb01 Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Thu, 7 Jun 2018 15:26:26 -0700 Subject: [PATCH] Revert "Replace MONOTONIC clock with BOOTTIME clock" This reverts commit e9c3f04f8628883091ca0912dd50b80fb9560316. Change-Id: Iabdead2a535b26bc3f7df1987265c4e2aea4f62e CRs-Fixed: 2241735 --- core/SystemStatus.h | 6 +++--- gnss/GnssAdapter.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/SystemStatus.h b/core/SystemStatus.h index 46e004a8..ac59cdc7 100644 --- a/core/SystemStatus.h +++ b/core/SystemStatus.h @@ -71,10 +71,10 @@ public: static const uint32_t maxItem = 5; SystemStatusItemBase() { - timeval tv; - gettimeofday(&tv, NULL); + struct timespec tv; + clock_gettime(CLOCK_MONOTONIC, &tv); mUtcTime.tv_sec = tv.tv_sec; - mUtcTime.tv_nsec = tv.tv_usec *1000ULL; + mUtcTime.tv_nsec = tv.tv_nsec; mUtcReported = mUtcTime; }; virtual ~SystemStatusItemBase() {}; diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index fd26ac1e..30bc4212 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -86,7 +86,7 @@ GnssAdapter::GnssAdapter() : pthread_condattr_t condAttr; pthread_condattr_init(&condAttr); - pthread_condattr_setclock(&condAttr, CLOCK_BOOTTIME); + pthread_condattr_setclock(&condAttr, CLOCK_MONOTONIC); pthread_cond_init(&mNiData.session.tCond, &condAttr); pthread_cond_init(&mNiData.sessionEs.tCond, &condAttr); pthread_condattr_destroy(&condAttr); @@ -2343,7 +2343,7 @@ static void* niThreadProc(void *args) pthread_mutex_lock(&pSession->tLock); /* Calculate absolute expire time */ - clock_gettime(CLOCK_BOOTTIME, &present_time); + clock_gettime(CLOCK_MONOTONIC, &present_time); expire_time.tv_sec = present_time.tv_sec + pSession->respTimeLeft; expire_time.tv_nsec = present_time.tv_nsec; LOC_LOGD("%s]: time out set for abs time %ld with delay %d sec",