Replace sys/time.h with <chrono> for portability/modernization.

This commit is contained in:
Ryan Volz
2023-07-18 17:31:02 -04:00
committed by Bastian Bloessl
parent a15d6bb34f
commit 28be829378
4 changed files with 30 additions and 19 deletions
+7 -4
View File
@@ -16,9 +16,9 @@
*/
#include "packet_pad_impl.h"
#include <chrono>
#include <gnuradio/io_signature.h>
#include <iostream>
#include <sys/time.h>
#ifdef FOO_UHD
#include <uhd/types/time_spec.hpp>
#endif
@@ -58,9 +58,12 @@ packet_pad_impl::add_sob(uint64_t item) {
#ifdef FOO_UHD
if(d_delay) {
static const pmt::pmt_t time_key = pmt::string_to_symbol("tx_time");
struct timeval t;
gettimeofday(&t, NULL);
uhd::time_spec_t now = uhd::time_spec_t(t.tv_sec + t.tv_usec / 1000000.0)
double t_now(
std::chrono::duration<double>(std::chrono::system_clock::now()
.time_since_epoch()
).count()
);
uhd::time_spec_t now = uhd::time_spec_t(t_now)
+ uhd::time_spec_t(d_delay_sec);
const pmt::pmt_t time_value = pmt::make_tuple(