Invensense: 6515: use CLOCK_BOOTTIME for timestamps

Sensor timestamps must include time during sleep.  CLOCK_MONOTONIC
does not include time during sleep, so sensor timestamps need to use
CLOCK_BOOTTIME instead.

Change-Id: I40c91dec5cbf4e7ec99c239de0725d492ba40e2f
diff --git a/6515/libsensors_iio/MPLSensor.cpp b/6515/libsensors_iio/MPLSensor.cpp
index 1cfab7a..c66007e 100644
--- a/6515/libsensors_iio/MPLSensor.cpp
+++ b/6515/libsensors_iio/MPLSensor.cpp
@@ -1822,7 +1822,7 @@
             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 @@
 
     /* 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 @@
 
     /* 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 @@
 
     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 @@
         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 @@
         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 @@
                     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;
@@ -5230,6 +5230,7 @@
 
     // 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 @@
 {
     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;
 }