Search code examples
androidtangoarcore

Get true timestamps of motion sensors on Android


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.


Solution

  • 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.