UHD: Implement getting current device timestamp.

This commit is contained in:
Alexander Chemeris
2015-07-11 12:47:32 -04:00
parent 601a69a45e
commit d369f68e4e
2 changed files with 7 additions and 2 deletions

View File

@@ -329,6 +329,8 @@ public:
inline double getSampleRate() { return tx_rate; }
inline double numberRead() { return rx_pkt_cnt; }
inline double numberWritten() { return 0; }
TIMESTAMP getCurrentTimestampRx() { return current_time.to_ticks(rx_rate); }
TIMESTAMP getCurrentTimestampTx() { return current_time.to_ticks(tx_rate); }
/** Receive and process asynchronous message
@return true if message received or false on timeout or error
@@ -368,6 +370,7 @@ private:
uhd::time_spec_t prev_ts;
TIMESTAMP ts_initial, ts_offset;
uhd::time_spec_t current_time;
std::vector<smpl_buf *> rx_buffers;
void init_gains();
@@ -1025,8 +1028,8 @@ int uhd_device::readSamples(std::vector<short *> &bufs, int len, bool *overrun,
continue;
}
ts = metadata.time_spec;
LOG(DEBUG) << "Received timestamp = " << ts.get_real_secs();
current_time = metadata.time_spec;
LOG(DEBUG) << "Received timestamp = " << current_time.get_real_secs();
for (size_t i = 0; i < rx_buffers.size(); i++) {
rc = rx_buffers[i]->write((short *) &pkt_bufs[i].front(),

View File

@@ -130,6 +130,8 @@ class RadioDevice {
virtual double getSampleRate()=0;
virtual double numberRead()=0;
virtual double numberWritten()=0;
virtual TIMESTAMP getCurrentTimestampRx() = 0;
virtual TIMESTAMP getCurrentTimestampTx() = 0;
};