aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/lib/include/uhdlib/usrp/common/recv_packet_demuxer_3000.hpp16
-rw-r--r--host/lib/include/uhdlib/utils/atomic.hpp7
2 files changed, 14 insertions, 9 deletions
diff --git a/host/lib/include/uhdlib/usrp/common/recv_packet_demuxer_3000.hpp b/host/lib/include/uhdlib/usrp/common/recv_packet_demuxer_3000.hpp
index 3a17b864e..54ae10908 100644
--- a/host/lib/include/uhdlib/usrp/common/recv_packet_demuxer_3000.hpp
+++ b/host/lib/include/uhdlib/usrp/common/recv_packet_demuxer_3000.hpp
@@ -8,7 +8,6 @@
#ifndef INCLUDED_LIBUHD_USRP_COMMON_RECV_PACKET_DEMUXER_3000_HPP
#define INCLUDED_LIBUHD_USRP_COMMON_RECV_PACKET_DEMUXER_3000_HPP
-#include <uhdlib/utils/system_time.hpp>
#include <uhd/config.hpp>
#include <uhd/transport/zero_copy.hpp>
#include <uhd/utils/log.hpp>
@@ -18,6 +17,7 @@
#include <boost/enable_shared_from_this.hpp>
#include <queue>
#include <map>
+#include <chrono>
#include <stdint.h>
namespace uhd{ namespace usrp{
@@ -36,15 +36,19 @@ namespace uhd{ namespace usrp{
transport::managed_recv_buffer::sptr get_recv_buff(const uint32_t sid, const double timeout)
{
- const time_spec_t exit_time =
- time_spec_t(timeout) + uhd::get_system_time();
+ const auto exit_time = std::chrono::high_resolution_clock::now()
+ + std::chrono::microseconds(int64_t(timeout * 1e6));
transport::managed_recv_buffer::sptr buff;
buff = _internal_get_recv_buff(sid, timeout);
while (not buff) //loop until timeout
{
- const time_spec_t delta = exit_time - uhd::get_system_time();
- const double new_timeout = delta.get_real_secs();
- if (new_timeout < 0.0) break;
+ const auto delta = exit_time - std::chrono::high_resolution_clock::now();
+ const double new_timeout =
+ std::chrono::duration_cast<std::chrono::duration<double>>(delta)
+ .count();
+ if (new_timeout < 0.0) {
+ break;
+ }
buff = _internal_get_recv_buff(sid, new_timeout);
}
return buff;
diff --git a/host/lib/include/uhdlib/utils/atomic.hpp b/host/lib/include/uhdlib/utils/atomic.hpp
index 5436eea81..303df1bc9 100644
--- a/host/lib/include/uhdlib/utils/atomic.hpp
+++ b/host/lib/include/uhdlib/utils/atomic.hpp
@@ -10,9 +10,9 @@
#include <uhd/config.hpp>
#include <uhd/types/time_spec.hpp>
-#include <uhdlib/utils/system_time.hpp>
#include <boost/thread/thread.hpp>
#include <atomic>
+#include <chrono>
namespace uhd{
@@ -31,9 +31,10 @@ namespace uhd{
const double timeout
){
if (cond == value) return true;
- const time_spec_t exit_time = uhd::get_system_time() + time_spec_t(timeout);
+ const auto exit_time = std::chrono::high_resolution_clock::now()
+ + std::chrono::microseconds(int64_t(timeout * 1e6));
while (cond != value) {
- if (uhd::get_system_time() > exit_time) {
+ if (std::chrono::high_resolution_clock::now() > exit_time) {
return false;
}
boost::this_thread::interruption_point();