Android SensorEvent timestamp issue

∥☆過路亽.° 提交于 2020-01-01 07:04:23

问题


I am currently working on an android application where I have to log all the sensor values. I got the sensor event timestamp from "event.timestamp" and I converted this value into a unix timestamp.

long currTimeRelativeToBootMs = SystemClock.uptimeMillis();
long currTimeAbsoluteMs = System.currentTimeMillis();

mStartTimeAbsoluteS = ((double)(currTimeAbsoluteMs - currTimeRelativeToBootMs))/(double)1000.0;
...
//timestampRelativeInNs = event.timestamp
double temp = mStartTimeAbsoluteS+((double)timestampRelativeInNs)/1000000000.0;

My application works fine on my HTC phone (Android 2.x.x) but it did not work on the new Google Nexus7.

I compared the "event.timestamp"-values from the different devices. I started the devices approximately at the same time but I got rather different values. The one from the Nexus7 is longer by 4 figures .....

SensorEvent-Timestamp(HTC): 175120992123000

SensorEvent-Timestamp(Nex): 1355418999245703000

What could be the reason for that issue??? How can I fix that???

来源:https://stackoverflow.com/questions/14126068/android-sensorevent-timestamp-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!