From 2b2b9464f64b03c9ae7317555c7db9ec29aa8fcd Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 9 Apr 2013 19:59:40 -0500 Subject: gps: use to_ticks in query app to avoid rounding issues The to_ticks(1.0) is a preferable way to get whole seconds because it avoids possible rounding issues since just getting full seconds does not account for the frac seconds. --- host/utils/query_gpsdo_sensors.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host/utils') diff --git a/host/utils/query_gpsdo_sensors.cpp b/host/utils/query_gpsdo_sensors.cpp index de6bdcd72..8e34bb3d5 100644 --- a/host/utils/query_gpsdo_sensors.cpp +++ b/host/utils/query_gpsdo_sensors.cpp @@ -103,7 +103,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ boost::this_thread::sleep(boost::posix_time::seconds(1)); uhd::sensor_value_t gps_time = usrp->get_mboard_sensor("gps_time"); const uhd::time_spec_t last_pps_time = usrp->get_time_last_pps(); - if (last_pps_time.get_full_secs() == gps_time.to_int()) { + if (last_pps_time.to_ticks(1.0) == gps_time.to_int()) { std::cout << boost::format("GPS and UHD Device time are aligned.\n"); } else std::cout << boost::format("\nGPS and UHD Device time are NOT aligned. Try re-running the program. Double check 1 PPS connection from GPSDO.\n\n"); -- cgit v1.2.3