summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaadi Maalem <saadi.maalem@intel.com>2015-10-10 13:28:14 +0800
committerZhengyin Qian <qianzy@google.com>2015-10-11 11:29:42 -0700
commitf4cc1330d9a643d9624e2dfd9b4aa9eee31dc95c (patch)
treeb5ea962070446176c9ae67729dfdb4cc502bdb33
parentd230af7b63bc3f1f572bd8ed18f770cf71eb61b4 (diff)
downloadsensors-f4cc1330d9a643d9624e2dfd9b4aa9eee31dc95c.tar.gz
sensor: change als timestamp to CLOCK_BOOTTIME
CLOCK_BOOTTIME includes suspend time, so it would allow aplications to get correct time difference between two events even when system resumes from suspend state. Change-Id: I6986506105aaa4220ccca49738d089b630648317 Tracked-On: https://jira.ndg.intel.com/browse/MARVIN-893 Signed-off-by: Baixing Tan <baixingx.tan@intel.com> Reviewed-on: https://android.intel.com/422142 Reviewed-by: jenkins_ndg <jenkins_ndg@intel.com> Reviewed-by: Yan, Like <like.yan@intel.com> Tested-by: Yan, Like <like.yan@intel.com> Reviewed-by: Akue, LoicX <loicx.akue@intel.com> Reviewed-by: Tasayco Loarte, VictorX <victorx.tasayco.loarte@intel.com>
-rw-r--r--als/SensorBase.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/als/SensorBase.cpp b/als/SensorBase.cpp
index d8cfc43..5617e92 100644
--- a/als/SensorBase.cpp
+++ b/als/SensorBase.cpp
@@ -35,10 +35,18 @@ SensorBase::SensorBase(const char* dev_name,
data_fd(-1)
{
FUNC_LOG;
+ int ret;
+ unsigned int clockId;
ALOGV("%s(): dev_name=%s, data_name=%s ", __func__, dev_name, data_name);
if (data_name) {
data_fd = openInput(data_name);
+ if (data_fd >= 0) {
+ clockId = CLOCK_BOOTTIME;
+ ret = ioctl(data_fd, EVIOCSCLOCKID, &clockId);
+ if (ret != 0)
+ ALOGE("set timestamp to CLOCK_BOOTTIME failed!");
+ }
}
}