gpt4 book ai didi

android - Location.getTime() 总是返回没有毫秒的时间戳

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:25:57 25 4
gpt4 key购买 nike

我正在使用 LocationManager.GPS_PROVIDER 和注册 LocationListener 通过 LocationManager.requestLocationUpdates() 跟踪 GPS 位置。

我的问题:

所有经过测试的设备(Sony neo、Sony active、Moto G)都会生成 Location 对象,这些对象在它们的 getTime() 中没有几分之一秒:

<trkpt ...><time>2014-05-24T10:24:59.000Z</time></trkpt>
<trkpt ...><time>2014-05-24T10:25:00.000Z</time></trkpt>
<trkpt ...><time>2014-05-24T10:25:01.000Z</time></trkpt>
<trkpt ...><time>2014-05-24T10:25:02.000Z</time></trkpt>
<trkpt ...><time>2014-05-24T10:25:03.000Z</time></trkpt>

当我计算速度、倾斜度并与气压高度合并时,1 秒(1000 毫秒)的分辨率太不精确了。而且我不相信,所有修复都完全.000

我的问题:

最好将 System.currentTimeMillis() 作为我的跟踪点的时间戳,或者 GPS 定位通常远​​远落后于“实时”并且计算出的位置实际上是来自过去(落后几秒)?

备注:

最佳答案

根据我的经验,System.currentTimeMillis() 是获取时间戳的更好方法,这也是我在我的应用程序中所做的。但是,请注意,如 android 开发者网站所述,System.currentTimeMillis() 返回自 1970 年 1 月 1 日 00:00:00.0 UTC 以来的当前时间(以毫秒为单位),因此它实际上取决于什么你想用它来做什么。正如我所提到的,我发现它比其他形式的时间戳更可靠,并且它可能最适合您的情况。

关于android - Location.getTime() 总是返回没有毫秒的时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23958640/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com