Get true timestamps of motion sensors on Android

322 views Asked by At

It is known that readings of motion sensors are cached on queues, so there might be elapsed time between when the data are actually sampled and when they are popped from the queue. Is the timestamp member in SensorEvent the time when the data are sampled? According to the documentation in SensorEvent, it is probably not. Is there a way to measure the "true" timestamp at which the data are sampled? Thank you.

1

There are 1 answers

1
gtp On BEST ANSWER

The SensorEvent.timestamp is the time at which the event happened, or in other words, the time at which the data is generated. This is the most accurate timestamp value available, and the value you should use as the "true" timestamp for when the data was sampled in your calculations.