diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-04-26 14:43:12 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-07-12 11:42:59 -0700 |
commit | 9df9bea6c1812fdc03ef8ace29859f0c64d382d2 (patch) | |
tree | 82d8b04ba9f892d15ff403fd9ed190f0b1f32569 /host/lib/usrp/usrp1 | |
parent | 05722dcc51a09084865736651e46326041dd6038 (diff) | |
download | uhd-9df9bea6c1812fdc03ef8ace29859f0c64d382d2.tar.gz uhd-9df9bea6c1812fdc03ef8ace29859f0c64d382d2.tar.bz2 uhd-9df9bea6c1812fdc03ef8ace29859f0c64d382d2.zip |
lib: Purge some use of boost::system_time
These are all timeout loops, which now use
std::chrono::steady_clock::now() to check for timeout events.
Diffstat (limited to 'host/lib/usrp/usrp1')
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index 2bd573652..2134f8182 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -16,18 +16,20 @@ #include <uhd/utils/paths.hpp> #include <boost/format.hpp> #include <boost/filesystem.hpp> -#include <boost/thread/thread.hpp> #include <boost/lexical_cast.hpp> #include <boost/math/special_functions/round.hpp> #include <cstdio> +#include <chrono> using namespace uhd; using namespace uhd::usrp; using namespace uhd::transport; -const uint16_t USRP1_VENDOR_ID = 0xfffe; -const uint16_t USRP1_PRODUCT_ID = 0x0002; -static const boost::posix_time::milliseconds REENUMERATION_TIMEOUT_MS(3000); +namespace { + constexpr uint16_t USRP1_VENDOR_ID = 0xfffe; + constexpr uint16_t USRP1_PRODUCT_ID = 0x0002; + constexpr int64_t REENUMERATION_TIMEOUT_MS = 3000; +} const std::vector<usrp1_impl::dboard_slot_t> usrp1_impl::_dboard_slots{ usrp1_impl::DBOARD_SLOT_A, @@ -89,13 +91,14 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) vid = USRP1_VENDOR_ID; pid = USRP1_PRODUCT_ID; - const boost::system_time timeout_time = boost::get_system_time() + REENUMERATION_TIMEOUT_MS; + const auto timeout_time = + std::chrono::steady_clock::now() + + std::chrono::milliseconds(REENUMERATION_TIMEOUT_MS); //search for the device until found or timeout - while (boost::get_system_time() < timeout_time and usrp1_addrs.empty() and found != 0) - { - for(usb_device_handle::sptr handle: usb_device_handle::get_device_list(vid, pid)) - { + while (std::chrono::steady_clock::now() < timeout_time + and usrp1_addrs.empty() and found != 0) { + for (usb_device_handle::sptr handle : usb_device_handle::get_device_list(vid, pid)) { usb_control::sptr control; try{control = usb_control::make(handle, 0);} catch(const uhd::exception &){continue;} //ignore claimed |