diff options
author | Nick Vaccaro <nvaccaro@google.com> | 2015-07-23 23:15:10 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-07-23 23:15:10 +0000 |
commit | fee89ba683d594140db7d38abb340deb8e2e239d (patch) | |
tree | a3db025cc3bd38d7dcc5208ad2779e3712a1df02 | |
parent | e0c1691f695f828608c36315fa405db2fa8d153e (diff) | |
parent | 70d66cf47a692a165f668ae219d239b54a3dcc83 (diff) | |
download | invensense-fee89ba683d594140db7d38abb340deb8e2e239d.tar.gz |
am 70d66cf4: Invensense: 6515: use CLOCK_BOOTTIME for timestamps
* commit '70d66cf47a692a165f668ae219d239b54a3dcc83':
Invensense: 6515: use CLOCK_BOOTTIME for timestamps
-rw-r--r-- | 6515/libsensors_iio/MPLSensor.cpp | 15 | ||||
-rwxr-xr-x | 6515/libsensors_iio/SensorBase.cpp | 2 |
2 files changed, 9 insertions, 8 deletions
diff --git a/6515/libsensors_iio/MPLSensor.cpp b/6515/libsensors_iio/MPLSensor.cpp index ad6d4e9..1061598 100644 --- a/6515/libsensors_iio/MPLSensor.cpp +++ b/6515/libsensors_iio/MPLSensor.cpp @@ -1822,7 +1822,7 @@ int MPLSensor::enableDmpPedometer(int en, int interruptMode) mFeatureActiveMask |= INV_DMP_PEDOMETER_STEP; } - clock_gettime(CLOCK_MONOTONIC, &mt_pre); + clock_gettime(CLOCK_BOOTTIME, &mt_pre); } else { if (interruptMode) { mFeatureActiveMask &= ~INV_DMP_PEDOMETER; @@ -2827,7 +2827,7 @@ int MPLSensor::smHandler(sensors_event_t* s) /* Capture timestamp in HAL */ struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); + clock_gettime(CLOCK_BOOTTIME, &ts); s->timestamp = (int64_t) ts.tv_sec * 1000000000 + ts.tv_nsec; LOGV_IF(HANDLER_DATA, "HAL:sm data: %f - %lld - %d", @@ -2886,7 +2886,7 @@ int MPLSensor::sdHandler(sensors_event_t* s) /* get current timestamp */ struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts) ; + clock_gettime(CLOCK_BOOTTIME, &ts) ; s->timestamp = (int64_t)ts.tv_sec * 1000000000 + ts.tv_nsec; LOGV_IF(HANDLER_DATA, "HAL:sd data: %f - %lld - %d", @@ -2912,7 +2912,7 @@ int MPLSensor::scHandler(sensors_event_t* s) if (s->timestamp == 0 && update) { struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); + clock_gettime(CLOCK_BOOTTIME, &ts); s->timestamp = (int64_t) ts.tv_sec * 1000000000 + ts.tv_nsec; // workaround for some platform which has gap between monotonic clock // and Android SystemClock. @@ -4695,7 +4695,7 @@ int MPLSensor::readDmpOrientEvents(sensors_event_t* data, int count) temp.screen_orientation = screen_orientation; #endif struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); + clock_gettime(CLOCK_BOOTTIME, &ts); temp.timestamp = (int64_t) ts.tv_sec * 1000000000 + ts.tv_nsec; *data++ = temp; @@ -4767,7 +4767,7 @@ bool MPLSensor::hasStepCountPendingEvents(void) struct timespec t_now; int64_t interval = 0; - clock_gettime(CLOCK_MONOTONIC, &t_now); + clock_gettime(CLOCK_BOOTTIME, &t_now); interval = ((int64_t(t_now.tv_sec) * 1000000000LL + t_now.tv_nsec) - (int64_t(mt_pre.tv_sec) * 1000000000LL + mt_pre.tv_nsec)); @@ -4777,7 +4777,7 @@ bool MPLSensor::hasStepCountPendingEvents(void) interval, mStepCountPollTime); return false; } else { - clock_gettime(CLOCK_MONOTONIC, &mt_pre); + clock_gettime(CLOCK_BOOTTIME, &mt_pre); LOGV_IF(0, "Step Count previous time: %ld ms", mt_pre.tv_nsec / 1000); return true; @@ -5224,6 +5224,7 @@ int MPLSensor::inv_init_sysfs_attributes(void) // get proper (in absolute) IIO path & build MPU's sysfs paths inv_get_sysfs_path(sysfs_path); + LOGV_IF(true, "njv Invensense sysfs path : %s", sysfs_path); memcpy(mSysfsPath, sysfs_path, sizeof(sysfs_path)); sprintf(mpu.key, "%s%s", sysfs_path, "/key"); diff --git a/6515/libsensors_iio/SensorBase.cpp b/6515/libsensors_iio/SensorBase.cpp index 544ac15..f1d00fb 100755 --- a/6515/libsensors_iio/SensorBase.cpp +++ b/6515/libsensors_iio/SensorBase.cpp @@ -143,7 +143,7 @@ int64_t SensorBase::getTimestamp() { struct timespec t; t.tv_sec = t.tv_nsec = 0; - clock_gettime(CLOCK_MONOTONIC, &t); + clock_gettime(CLOCK_BOOTTIME, &t); return int64_t(t.tv_sec) * 1000000000LL + t.tv_nsec; } |