Skip first record when calculating replay speed and set minimum repla… (#3715)

* Skip first record when calculating replay speed and set minimum replay speed to 100 ms.
Fixes issue 3708

* Cosmetics
This commit is contained in:
Jim Taylor
2016-08-27 18:36:15 +02:00
committed by Andre Bernet
parent 1d735f2bd3
commit 34441618f8
+3 -2
View File
@@ -651,14 +651,15 @@ QDateTime TelemetrySimulator::LogPlaybackController::parseTransmittterTimestamp(
void TelemetrySimulator::LogPlaybackController::calcLogFrequency()
{
// examine up to 20 rows to determine log frequency in seconds
// Skip the first entry which contains the file open time
logFrequency = 25.5; // default value
QDateTime lastTime;
for (int i = 1; (i < 20) && (i < csvRecords.count()); i++)
for (int i = 2; (i < 21) && (i < csvRecords.count()); i++)
{
QDateTime logTime = parseTransmittterTimestamp(csvRecords[i]);
// ugh - no timespan in this Qt version
double timeDiff = (logTime.toMSecsSinceEpoch() - lastTime.toMSecsSinceEpoch()) / 1000.0;
if ((timeDiff > 0) && (timeDiff < logFrequency)) {
if ((timeDiff > 0.1) && (timeDiff < logFrequency)) {
logFrequency = timeDiff;
}
lastTime = logTime;