Bug on get_mboard_sensor("gps_time") : may return old value


Using USRP N210, UHD 3.2.1, windows7 (VC++ 9), GPSDO (Jackson Labs)

I first use :
set_time_next_pps(0, 1, 54000000)

Since gps time returns soon after pps edge occurs, I know that time is
to 0 at a known GPS time called gps_t_0 (which is gps time returned by
sensor + 1)
(this is based on previous comments of Nick
Re: [Discuss-gnuradio] How to check at which GPS time correspond the pps)

Then, I want to check that gps_t_0 is really my starting point, then I
discovered the bug
Here is pseudo code (in real code I use get_full_secs())
gps_now = get_mboard_sensor(“gps_time”)
time_now = get_time_now()
if ((gps_now - gps_t_0) != time_now){
std::cout << (gps_now - gps_t_0) - time_now

If there is no Sleep(3000), results are OK
If I enable the Sleep(3000), it prints at every loop iteration either -2
If I change the sleep into Sleep(6000), it prints at every loop
iteration -5
or -6

This means that query of gps_time is proportionally to Sleep(x) in the
So I guess there is a problem of data flushing, the sensor query
first gps phrase generated by GPSDO since last gps_time query
A way to solve this bug may be to flush previous gps_time phrase
by GPSDO prior to get current time ??

Trying to dig into code (so far searching around get_nmea(…) in
gps_ctrl.cpp l.148), but not sure this can be solved in host code ??