Replace MONOTONIC clock with BOOTTIME clock
MONOTONIC clock doesn't tick when device is in suspend mode. BOOTTIME clock handles suspend mode while. Change-Id: I14ce943ddfd409fcc5cb70acde0cd4f5c94d1058 CRs-Fixed: 2241735
This commit is contained in:
parent
533f43e690
commit
e9c3f04f86
2 changed files with 5 additions and 5 deletions
|
@ -71,10 +71,10 @@ public:
|
|||
static const uint32_t maxItem = 5;
|
||||
|
||||
SystemStatusItemBase() {
|
||||
struct timespec tv;
|
||||
clock_gettime(CLOCK_MONOTONIC, &tv);
|
||||
timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
mUtcTime.tv_sec = tv.tv_sec;
|
||||
mUtcTime.tv_nsec = tv.tv_nsec;
|
||||
mUtcTime.tv_nsec = tv.tv_usec *1000ULL;
|
||||
mUtcReported = mUtcTime;
|
||||
};
|
||||
virtual ~SystemStatusItemBase() {};
|
||||
|
|
|
@ -86,7 +86,7 @@ GnssAdapter::GnssAdapter() :
|
|||
|
||||
pthread_condattr_t condAttr;
|
||||
pthread_condattr_init(&condAttr);
|
||||
pthread_condattr_setclock(&condAttr, CLOCK_MONOTONIC);
|
||||
pthread_condattr_setclock(&condAttr, CLOCK_BOOTTIME);
|
||||
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_MONOTONIC, &present_time);
|
||||
clock_gettime(CLOCK_BOOTTIME, &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",
|
||||
|
|
Loading…
Reference in a new issue