Android location getTime() always returns big different time

对着背影说爱祢 提交于 2019-12-01 23:49:34

There's absolutely nothing wrong with the formatting here.

Look at the log:

05-16 16:09:30.227: D/location.getTime()(1279): 1368590417000
05-16 16:09:30.237: D/NMEAGPRMCTime(1279): 040017
05-16 16:09:30.247: D/NMEAGPRMCDate(1279): 130515

Using epochconverter you can see that the "millis since epoch" value of 1368590417000 is actually Wed, 15 May 2013 04:00:17 UTC. So a time of 040017 and a date of 130515 is exactly right.

I suspect you're actually confused by what Location.getTime() does - it returns the time of the fix, not the current time. So basically, that location was obtained at 04:00:17 UTC, regardless of the current date/time.

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