1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Edouard Griffiths
7de805b433
Merge pull request #1094 from srcejon/fix_980
Fix File Input date time.
2021-12-30 22:23:51 +01:00
Jon Beniston
88499f08dd Fix FileInput API report of absolute time following PR #981. 2021-12-30 13:24:39 +00:00

View File

@ -110,14 +110,14 @@ void FileInput::openFileStream()
{ {
// Some WAV files written by SDR tools have auxi header // Some WAV files written by SDR tools have auxi header
m_centerFrequency = header.m_auxi.m_centerFreq; m_centerFrequency = header.m_auxi.m_centerFreq;
m_startingTimeStamp = header.getStartTime().toMSecsSinceEpoch() / 1000; m_startingTimeStamp = header.getStartTime().toMSecsSinceEpoch();
} }
else else
{ {
// Attempt to extract start time and frequency from filename // Attempt to extract start time and frequency from filename
QDateTime startTime; QDateTime startTime;
if (WavFileRecord::getStartTime(m_settings.m_fileName, startTime)) { if (WavFileRecord::getStartTime(m_settings.m_fileName, startTime)) {
m_startingTimeStamp = startTime.toMSecsSinceEpoch() / 1000; m_startingTimeStamp = startTime.toMSecsSinceEpoch();
} }
WavFileRecord::getCenterFrequency(m_settings.m_fileName, m_centerFrequency); WavFileRecord::getCenterFrequency(m_settings.m_fileName, m_centerFrequency);
} }
@ -655,7 +655,7 @@ void FileInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
t = t.addMSecs(t_msec); t = t.addMSecs(t_msec);
response.getFileInputReport()->setElapsedTime(new QString(t.toString("HH:mm:ss.zzz"))); response.getFileInputReport()->setElapsedTime(new QString(t.toString("HH:mm:ss.zzz")));
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);