<bdo id='iOBiC'></bdo><ul id='iOBiC'></ul>

    <tfoot id='iOBiC'></tfoot>

    <legend id='iOBiC'><style id='iOBiC'><dir id='iOBiC'><q id='iOBiC'></q></dir></style></legend>
  1. <i id='iOBiC'><tr id='iOBiC'><dt id='iOBiC'><q id='iOBiC'><span id='iOBiC'><b id='iOBiC'><form id='iOBiC'><ins id='iOBiC'></ins><ul id='iOBiC'></ul><sub id='iOBiC'></sub></form><legend id='iOBiC'></legend><bdo id='iOBiC'><pre id='iOBiC'><center id='iOBiC'></center></pre></bdo></b><th id='iOBiC'></th></span></q></dt></tr></i><div id='iOBiC'><tfoot id='iOBiC'></tfoot><dl id='iOBiC'><fieldset id='iOBiC'></fieldset></dl></div>
    1. <small id='iOBiC'></small><noframes id='iOBiC'>

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

      时间:2023-09-01

        <tfoot id='22In7'></tfoot>

        <small id='22In7'></small><noframes id='22In7'>

              <i id='22In7'><tr id='22In7'><dt id='22In7'><q id='22In7'><span id='22In7'><b id='22In7'><form id='22In7'><ins id='22In7'></ins><ul id='22In7'></ul><sub id='22In7'></sub></form><legend id='22In7'></legend><bdo id='22In7'><pre id='22In7'><center id='22In7'></center></pre></bdo></b><th id='22In7'></th></span></q></dt></tr></i><div id='22In7'><tfoot id='22In7'></tfoot><dl id='22In7'><fieldset id='22In7'></fieldset></dl></div>

                <bdo id='22In7'></bdo><ul id='22In7'></ul>
              • <legend id='22In7'><style id='22In7'><dir id='22In7'><q id='22In7'></q></dir></style></legend>
                  <tbody id='22In7'></tbody>
                本文介绍了Location.getTime() 总是返回没有毫秒的时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

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

                I'm tracking GPS locations with LocationManager.requestLocationUpdates() using LocationManager.GPS_PROVIDER and registering a LocationListener.

                我的问题:

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

                All tested devices (Sony neo, Sony active, Moto G) produce Location objects which do not have fractions of a second in their 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.

                As I'm calculating speed, incline and merge with barometic altitude, 1s (1000ms) resolution is way too imprecise. And I do not believe, that the fixes are all exactly at .000.

                我的问题:

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

                Is is better to take System.currentTimeMillis() as the timestamp for my track-points, or is the GPS fix generally far behind "real time" and the calculated positions are actually those from the past (several seconds behind)?

                备注:

                • 我知道在使用 GPS 数据时速度计算并不精确且相当复杂
                • 这不是 Matching Location.getTime() 毫秒到 NMEA 语句 的副本

                推荐答案

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

                In my experience, System.currentTimeMillis() is a much better way to take timestamps, and it is what I am doing in my app. However, please be advised that, as stated on the android developer site, System.currentTimeMillis() Returns the current time in milliseconds since January 1, 1970 00:00:00.0 UTC so it really depends on what you want to use it for. As I mentioned though, I found it to be more reliable than other forms of timestamps and it is probably best suited for your case.

                这篇关于Location.getTime() 总是返回没有毫秒的时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:MKMapView MKCircle 渲染一个半径太大的圆 下一篇:从另一台设备实时定位安卓设备

                相关文章

                最新文章

                <small id='1ozn2'></small><noframes id='1ozn2'>

                  <i id='1ozn2'><tr id='1ozn2'><dt id='1ozn2'><q id='1ozn2'><span id='1ozn2'><b id='1ozn2'><form id='1ozn2'><ins id='1ozn2'></ins><ul id='1ozn2'></ul><sub id='1ozn2'></sub></form><legend id='1ozn2'></legend><bdo id='1ozn2'><pre id='1ozn2'><center id='1ozn2'></center></pre></bdo></b><th id='1ozn2'></th></span></q></dt></tr></i><div id='1ozn2'><tfoot id='1ozn2'></tfoot><dl id='1ozn2'><fieldset id='1ozn2'></fieldset></dl></div>
                  <legend id='1ozn2'><style id='1ozn2'><dir id='1ozn2'><q id='1ozn2'></q></dir></style></legend>
                  • <bdo id='1ozn2'></bdo><ul id='1ozn2'></ul>

                1. <tfoot id='1ozn2'></tfoot>