The sensor timestamp is actually nanoseconds of uptime, not system time in nanoseconds. See SensorEvent.timestamp to absolute (utc) timestamp?.
In theory, you can convert sensor timestamp to time in milliseconds using:
long timeInMillis = (new Date()).getTime()
+ (sensorEvent.timestamp - System.nanoTime()) / 1000000L;
You could even bracket the (new Date()).getTime()
call with two System.nanoTime()
calls and average them to get closer to the actual offset.
Then you can format the sensor time as date and time.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…