diff --git a/core/SystemStatus.h b/core/SystemStatus.h index 1c3adc84..ff5e7548 100644 --- a/core/SystemStatus.h +++ b/core/SystemStatus.h @@ -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() {}; diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index d08bd447..9ab1fd6a 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_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",