1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Switch FileRecord timestamp resolution to milliseconds

This commit is contained in:
Andreas Baulig 2021-08-04 13:38:42 +00:00
parent 14e75232df
commit e8a8ef6f3d
No known key found for this signature in database
GPG Key ID: 5225DCE5A4A2EE20
4 changed files with 8 additions and 7 deletions

View File

@ -19,6 +19,7 @@
#include <QDebug> #include <QDebug>
#include <QNetworkReply> #include <QNetworkReply>
#include <QBuffer> #include <QBuffer>
#include <QDateTime>
#include "SWGDeviceSettings.h" #include "SWGDeviceSettings.h"
#include "SWGDeviceState.h" #include "SWGDeviceState.h"
@ -74,8 +75,8 @@ void FileOutput::openFileStream()
int actualSampleRate = m_settings.m_sampleRate * (1<<m_settings.m_log2Interp); int actualSampleRate = m_settings.m_sampleRate * (1<<m_settings.m_log2Interp);
header.sampleRate = actualSampleRate; header.sampleRate = actualSampleRate;
header.centerFrequency = m_settings.m_centerFrequency; header.centerFrequency = m_settings.m_centerFrequency;
m_startingTimeStamp = time(0); m_startingTimeStamp = QDateTime::currentMSecsSinceEpoch();
header.startTimeStamp = m_startingTimeStamp; header.startTimeStamp = (quint64)m_startingTimeStamp;
header.sampleSize = SDR_RX_SAMP_SZ; header.sampleSize = SDR_RX_SAMP_SZ;
FileRecord::writeHeader(m_ofstream, header); FileRecord::writeHeader(m_ofstream, header);

View File

@ -233,7 +233,7 @@ private:
FileOutputWorker* m_fileOutputWorker; FileOutputWorker* m_fileOutputWorker;
QThread m_fileOutputWorkerThread; QThread m_fileOutputWorkerThread;
QString m_deviceDescription; QString m_deviceDescription;
std::time_t m_startingTimeStamp; qint64 m_startingTimeStamp;
const QTimer& m_masterTimer; const QTimer& m_masterTimer;
QNetworkAccessManager *m_networkManager; QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest; QNetworkRequest m_networkRequest;

View File

@ -367,8 +367,8 @@ void FileInputGUI::updateWithStreamTime()
QString s_timems = t.toString("HH:mm:ss.zzz"); QString s_timems = t.toString("HH:mm:ss.zzz");
ui->relTimeText->setText(s_timems); ui->relTimeText->setText(s_timems);
qint64 startingTimeStampMsec = m_startingTimeStamp * 1000LL; qint64 startingTimeStampMsec = m_startingTimeStamp;
QDateTime dt = QDateTime::fromMSecsSinceEpoch(startingTimeStampMsec); QDateTime dt = QDateTime::fromMSecsSinceEpoch(startingTimeStampMsec);
dt = dt.addSecs(t_sec); dt = dt.addSecs(t_sec);
dt = dt.addMSecs(t_msec); dt = dt.addMSecs(t_msec);
QString s_date = dt.toString("yyyy-MM-dd HH:mm:ss.zzz"); QString s_date = dt.toString("yyyy-MM-dd HH:mm:ss.zzz");

View File

@ -183,8 +183,8 @@ void FileRecord::writeHeader()
Header header; Header header;
header.sampleRate = m_sampleRate; header.sampleRate = m_sampleRate;
header.centerFrequency = m_centerFrequency; header.centerFrequency = m_centerFrequency;
std::time_t ts = time(0); qint64 ts = QDateTime::currentMSecsSinceEpoch();
header.startTimeStamp = ts + (m_msShift / 1000); header.startTimeStamp = (quint64)(ts + m_msShift);
header.sampleSize = SDR_RX_SAMP_SZ; header.sampleSize = SDR_RX_SAMP_SZ;
header.filler = 0; header.filler = 0;