aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/lib/usrp/dboard_iface.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/host/lib/usrp/dboard_iface.cpp b/host/lib/usrp/dboard_iface.cpp
index b2ff23ab9..4a3836151 100644
--- a/host/lib/usrp/dboard_iface.cpp
+++ b/host/lib/usrp/dboard_iface.cpp
@@ -13,11 +13,20 @@ using namespace uhd::usrp;
void dboard_iface::sleep(const boost::chrono::nanoseconds& time)
{
- // nanosleep is not really accurate in userland and it is also not very
- // cross-platform. So just sleep for the minimum amount of time in us.
- if (time < boost::chrono::microseconds(1)) {
- std::this_thread::sleep_for(std::chrono::microseconds(1));
+ // This sleep function is intended to create a delay on the
+ // device. If a command time is set, just increment that time.
+ // If not, the best we can do is just do a sleep on the host.
+ // FIXME: Create a delay in the FPGA on the device.
+ auto cmd_time = get_command_time();
+ if (cmd_time.get_real_secs() != 0.0) {
+ set_command_time(cmd_time + uhd::time_spec_t(time.count()));
} else {
- std::this_thread::sleep_for(std::chrono::microseconds(time.count()));
+ // nanosleep is not really accurate in userland and it is also not very
+ // cross-platform. So just sleep for the minimum amount of time in us.
+ if (time < boost::chrono::microseconds(1)) {
+ std::this_thread::sleep_for(std::chrono::microseconds(1));
+ } else {
+ std::this_thread::sleep_for(std::chrono::microseconds(time.count()));
+ }
}
}