1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 13:51:47 -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 <QNetworkReply>
#include <QBuffer>
#include <QDateTime>
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
@ -74,8 +75,8 @@ void FileOutput::openFileStream()
int actualSampleRate = m_settings.m_sampleRate * (1<<m_settings.m_log2Interp);
header.sampleRate = actualSampleRate;
header.centerFrequency = m_settings.m_centerFrequency;
m_startingTimeStamp = time(0);
header.startTimeStamp = m_startingTimeStamp;
m_startingTimeStamp = QDateTime::currentMSecsSinceEpoch();
header.startTimeStamp = (quint64)m_startingTimeStamp;
header.sampleSize = SDR_RX_SAMP_SZ;
FileRecord::writeHeader(m_ofstream, header);

View File

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

View File

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

View File

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