summaryrefslogtreecommitdiffstats
path: root/libsensors
diff options
context:
space:
mode:
authorKyle Repinski <repinski23@gmail.com>2015-11-10 17:08:22 -0600
committerZiyan <jaraidaniel@gmail.com>2016-01-17 22:41:00 +0100
commitcb8261e6db2a6a13ea67b1848e1cab6b0e7091ec (patch)
treee9102f989c42bef769442b101dda2ba6f35c163e /libsensors
parent85779371e527f94e865dc0450c703676d858bc30 (diff)
downloaddevice_samsung_tuna-cb8261e6db2a6a13ea67b1848e1cab6b0e7091ec.zip
device_samsung_tuna-cb8261e6db2a6a13ea67b1848e1cab6b0e7091ec.tar.gz
device_samsung_tuna-cb8261e6db2a6a13ea67b1848e1cab6b0e7091ec.tar.bz2
libsensors/invensense: Clean-up.
Diffstat (limited to 'libsensors')
-rw-r--r--libsensors/SamsungSensorBase.cpp7
-rw-r--r--libsensors/SamsungSensorBase.h5
2 files changed, 12 insertions, 0 deletions
diff --git a/libsensors/SamsungSensorBase.cpp b/libsensors/SamsungSensorBase.cpp
index 49ba7e8..0492d94 100644
--- a/libsensors/SamsungSensorBase.cpp
+++ b/libsensors/SamsungSensorBase.cpp
@@ -139,6 +139,13 @@ done:
return result;
}
+int64_t SamsungSensorBase::getTimestamp() {
+ struct timespec t;
+ t.tv_sec = t.tv_nsec = 0;
+ clock_gettime(CLOCK_BOOTTIME, &t);
+ return int64_t(t.tv_sec)*1000000000LL + t.tv_nsec;
+}
+
int SamsungSensorBase::readEvents(sensors_event_t* data, int count)
{
if (count < 1)
diff --git a/libsensors/SamsungSensorBase.h b/libsensors/SamsungSensorBase.h
index c989c71..1440e37 100644
--- a/libsensors/SamsungSensorBase.h
+++ b/libsensors/SamsungSensorBase.h
@@ -40,6 +40,11 @@ protected:
int mSensorCode;
pthread_mutex_t mLock;
+ static int64_t getTimestamp();
+ static int64_t timevalToNano(timeval const& t) {
+ return t.tv_sec*1000000000LL + t.tv_usec*1000;
+ }
+
char *makeSysfsName(const char *input_name,
const char *input_file);