2

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???

edererm
  • 31
  • 1
  • 6
  • try restarting Nexus again and check the timestamps – nayab Jan 10 '13 at 12:04
  • i got it! the timestamp form the nexus 7 is already a unix timestamp (in nanoseconds) whereas the htc sensor timestamp is the time in nanoseconds since systemstart ... maybe it depends on the new android version 4.2?!? – edererm Jan 14 '13 at 12:59
  • Good ,event.timestamp should have same meaning on all the android systems – nayab Jan 14 '13 at 14:00

0 Answers0