2

我目前正在开发一个必须记录所有传感器值的 android 应用程序。我从“event.timestamp”中获得了传感器事件时间戳,并将这个值转换为 unix 时间戳。

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;

我的应用程序在我的 HTC 手机 (Android 2.xx) 上运行良好,但在新的 Google Nexus7 上却无法运行。

我比较了来自不同设备的“event.timestamp”值。我几乎同时启动了这些设备,但我得到了相当不同的值。来自 Nexus7 的那个长了 4 位数.....

SensorEvent-时间戳(HTC):175120992123000

SensorEvent-时间戳(Nex):1355418999245703000

这个问题可能是什么原因???我该如何解决?

4

0 回答 0