diff options
Diffstat (limited to 'host/examples/tx_samples_from_file.cpp')
-rw-r--r-- | host/examples/tx_samples_from_file.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/host/examples/tx_samples_from_file.cpp b/host/examples/tx_samples_from_file.cpp index ba2ad6cb8..31d70ad7e 100644 --- a/host/examples/tx_samples_from_file.cpp +++ b/host/examples/tx_samples_from_file.cpp @@ -16,6 +16,8 @@ #include <fstream> #include <complex> #include <csignal> +#include <chrono> +#include <thread> namespace po = boost::program_options; @@ -74,7 +76,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("bw", po::value<double>(&bw), "analog frontend filter bandwidth in Hz") ("ref", po::value<std::string>(&ref)->default_value("internal"), "reference source (internal, external, mimo)") ("wirefmt", po::value<std::string>(&wirefmt)->default_value("sc16"), "wire format (sc8 or sc16)") - ("delay", po::value<double>(&delay)->default_value(0.0), "specify a delay between repeated transmission of file") + ("delay", po::value<double>(&delay)->default_value(0.0), "specify a delay between repeated transmission of file (in seconds)") ("channel", po::value<std::string>(&channel)->default_value("0"), "which channel to use") ("repeat", "repeatedly transmit file") ("int-n", "tune USRP with integer-n tuning") @@ -147,7 +149,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //set the antenna if (vm.count("ant")) usrp->set_tx_antenna(ant); - boost::this_thread::sleep(boost::posix_time::seconds(1)); //allow for some setup time + //allow for some setup time: + std::this_thread::sleep_for(std::chrono::seconds(1)); //Check Ref and LO Lock detect std::vector<std::string> sensor_names; @@ -193,7 +196,12 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ else if (type == "short") send_from_file<std::complex<short> >(tx_stream, file, spb); else throw std::runtime_error("Unknown type " + type); - if(repeat and delay != 0.0) boost::this_thread::sleep(boost::posix_time::milliseconds(delay)); + if(repeat and delay > 0.0) { + boost::this_thread::sleep(boost::posix_time::milliseconds(delay)); + std::this_thread::sleep_for( + std::chrono::milliseconds(int64_t(delay*1000)) + ); + } } while(repeat and not stop_signal_called); //finished |