# le\_pos\_GetTIme Returns the Same Time

**URL:** <https://forum.legato.io/t/le-pos-gettime-returns-the-same-time/5028>\
**Category:** Legato Application Framework\
**Created:** [February 26, 2020, 4:04am UTC](https://forum.legato.io/t/le-pos-gettime-returns-the-same-time/5028 "2020-02-26T04:04:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbeckwith](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/dbeckwith/32/663_2.png) [@dbeckwith](https://forum.legato.io/u/dbeckwith)\
**Post date:** [February 26, 2020, 4:04am UTC](https://forum.legato.io/t/le-pos-gettime-returns-the-same-time/5028/1 "2020-02-26T04:04:26Z")

</div>

I’m using a WP85 with Legato 19.02.0 and I have a strange issue. When I remove the GPS antenna is start getting the same time value returned when I call `le_pos_GetTime()`. I check the state of the GPS and it still says it has a 2D fix (I have an internal antenna as well like the MangOH red design.

If I run a `gnss get time` command on the command line then the time updates but subsequent read of `le_pos_GetTime()` return the updated time value.

Thoughts,  
Darren

---

<div class="post-metadata">

**Author:** ![lotam](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@lotam](https://forum.legato.io/u/lotam)\
**Post date:** [February 26, 2020, 6:58am UTC](https://forum.legato.io/t/le-pos-gettime-returns-the-same-time/5028/2 "2020-02-26T06:58:39Z")

</div>

Hi Darren,

Per understanding, le\_pos\_GetTime() return time based on last position sample, thus if no change in position sample, le\_pos\_GetTime() will continue to get the same fixed time from same position sample reference.

Using “gnss get time”, it calls le\_gnss\_AddPositionHandler(), so position sample is updated and le\_pos\_GetTime() may return new time.

Can you try call le\_gnss\_AddPositionHandler() or le\_pos\_AddMovementHandler() in your app code and observe any change in le\_pos\_GetTime() return?

Hope it helps and please mark solution if this answer your questions.  
Thx

---

<div class="post-metadata">

**Author:** ![dbeckwith](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/dbeckwith/32/663_2.png) [@dbeckwith](https://forum.legato.io/u/dbeckwith)\
**Post date:** [February 26, 2020, 5:11pm UTC](https://forum.legato.io/t/le-pos-gettime-returns-the-same-time/5028/3 "2020-02-26T17:11:07Z")

</div>

@lotam,

I’ll admit I’m a little confused by you statement “return time based on last position sample”. If I still have a 2D fix, confirmed with the gnss command then why is the Position service no longer receiving updates to change the last position sample?

Thanks,

---

<div class="post-metadata">

**Author:** ![lotam](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@lotam](https://forum.legato.io/u/lotam)\
**Post date:** [February 27, 2020, 1:29am UTC](https://forum.legato.io/t/le-pos-gettime-returns-the-same-time/5028/4 "2020-02-27T01:29:29Z")

</div>

Hi Darren,  
Sorry if I replying too fast…  
Are you using le\_pos\_Get2DLocation() to get 2D fix?  
And is the 2D fix actually still updating? Or it just return the same location?

Thx

---

<div class="post-metadata">

**Author:** ![dbeckwith](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/dbeckwith/32/663_2.png) [@dbeckwith](https://forum.legato.io/u/dbeckwith)\
**Post date:** [February 27, 2020, 1:45am UTC](https://forum.legato.io/t/le-pos-gettime-returns-the-same-time/5028/5 "2020-02-27T01:45:31Z")

</div>

Originally I was using le\_pos\_Get2DLocation() to get a 2D fix. But there were inconsistencies when the reported time and position. This is when I noticed that under certain low GPS signal conditions the time would stay the same even though the gnsss get posState reported a 2D fix. Adding the le\_gnss\_AddPositionHandler seems to have fixed the issue but I’m trying to understand the reason for the behavior.

Thanks,  
Darren

---

<div class="post-metadata">

**Author:** ![wdev](https://avatars.discourse-cdn.com/v4/letter/w/d9b06d/32.png) [@wdev](https://forum.legato.io/u/wdev)\
**Post date:** [March 27, 2020, 5:06pm UTC](https://forum.legato.io/t/le-pos-gettime-returns-the-same-time/5028/6 "2020-03-27T17:06:27Z")

</div>

Hi Darren,

First of all, Positioning service is implemented on top of Legato GNSS service. It is NOT recommend to use Positioning and GNSS API in the same application.  
Legato Positioning service is a “high level” service with limited API and information regarding GNSS . That Positioning service was designed to manage several Positioning sources like GNSS, WiFi, sensors, gyro… Currently, Positioning service is based only on GNSS service.  
Therefore, I would recommend to use GNSS Legato API (le\_gnss functions) instead of “POSITIONING” Legato API (le\_pos functions).

About that issue, the le\_pos\_GetTime function is implemented on top of le\_gnss\_GetTime function, so I cannot explain that issue and different behavior from those functions.  
As GNSS rate is 1Hz, please note that you will have the same time info by calling le\_pos\_GetTime during that period. Similar behavior expected using le\_gnss\_GetTime.  
As you mentioned that adding the le\_gnss\_AddPositionHandler seems to have fixed the issue, I had a look on source code and le\_gnss\_AddPositionHandler must be called to get information from GNSS indeed, but it is done from Positioning Service COMPONENT\_INIT, calling gnss\_init function. By calling le\_pos\_AddMovementHandler, it will also call le\_gnss\_AddPositionHandler.

So my recommendation is to check that le\_gnss\_AddPositionHandler function is called, or definitively to use GNSS Legato API (le\_gnss functions).

Hope it helps !
