Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android SensorEvent时间戳问题_Android_Timestamp_Sensors_Unix Timestamp_Nexus 7 - Fatal编程技术网

Android SensorEvent时间戳问题

Android SensorEvent时间戳问题,android,timestamp,sensors,unix-timestamp,nexus-7,Android,Timestamp,Sensors,Unix Timestamp,Nexus 7,我目前正在开发一个android应用程序,我必须记录所有传感器值。我从“event.timestamp”中获得了传感器事件时间戳,并将该值转换为unix时间戳 long currTimeRelativeToBootMs = SystemClock.uptimeMillis(); long currTimeAbsoluteMs = System.currentTimeMillis(); mStartTimeAbsoluteS = ((double)(currTimeAbsoluteMs - cu

我目前正在开发一个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.x.x)上运行良好,但在新的Google Nexus7上无法运行

我比较了不同设备的“event.timestamp”值。我几乎在同一时间启动了这些设备,但得到的值却大不相同。Nexus7中的一个长了4位数

传感器事件时间戳(HTC):175120992123000

传感器事件时间戳(Nex):1355418999245703000


这个问题的原因是什么???如何修复此问题?

再次尝试重新启动Nexus并检查时间戳,我明白了!nexus 7的时间戳已经是unix时间戳(以纳秒为单位),而htc传感器的时间戳是自系统启动以来以纳秒为单位的时间。。。也许这取决于新的安卓版本4.2?!?很好,event.timestamp在所有android系统上应该具有相同的含义