aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/x300/x300_impl.cpp
diff options
context:
space:
mode:
authormichael-west <michael.west@ettus.com>2014-06-25 14:56:20 -0700
committermichael-west <michael.west@ettus.com>2014-06-25 14:56:20 -0700
commitbca5edb57979983a9eb8d6cd1016961552ad217c (patch)
tree887f28c8271a035209af5824ffa7b1d4410afe53 /host/lib/usrp/x300/x300_impl.cpp
parent96c30a11f2924fcb5f914f2922506fe6cfdd93ec (diff)
downloaduhd-bca5edb57979983a9eb8d6cd1016961552ad217c.tar.gz
uhd-bca5edb57979983a9eb8d6cd1016961552ad217c.tar.bz2
uhd-bca5edb57979983a9eb8d6cd1016961552ad217c.zip
Fix for BUG #492: UHD: set_time_unknown_pps() fails with GPSDO installed
- Added polling for PPS time change after setting time from GPSDO.
Diffstat (limited to 'host/lib/usrp/x300/x300_impl.cpp')
-rw-r--r--host/lib/usrp/x300/x300_impl.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp
index 2c291f422..fdf216cf2 100644
--- a/host/lib/usrp/x300/x300_impl.cpp
+++ b/host/lib/usrp/x300/x300_impl.cpp
@@ -831,8 +831,10 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
UHD_MSG(status) << "Initializing time to the GPSDO time" << std::endl;
const time_t tp = time_t(mb.gps->get_sensor("gps_time").to_int()+1);
_tree->access<time_spec_t>(mb_path / "time" / "pps").set(time_spec_t(tp));
- //wait for time to be set (timeout after 1 second)
- for (int i = 0; i < 10 && tp != (_tree->access<time_spec_t>(mb_path / "time" / "pps").get()).get_full_secs(); i++)
+
+ //wait for next PPS edge (timeout after 1 second)
+ time_spec_t pps_time = _tree->access<time_spec_t>(mb_path / "time" / "pps").get();
+ for (size_t i = 0; i < 10 && _tree->access<time_spec_t>(mb_path / "time" / "pps").get() == pps_time; i++)
boost::this_thread::sleep(boost::posix_time::milliseconds(100));
} else {
_tree->access<std::string>(mb_path / "clock_source" / "value").set("internal");