From 9df9bea6c1812fdc03ef8ace29859f0c64d382d2 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 26 Apr 2018 14:43:12 -0700 Subject: 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. --- host/lib/usrp/usrp1/usrp1_impl.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'host/lib/usrp/usrp1') 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 #include #include -#include #include #include #include +#include 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_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 -- cgit v1.2.3