Addition of "System Time" mode where frames are timestamped by

absolute time from the PC clock.
This commit is contained in:
Collin Kidder
2017-07-09 16:54:26 -04:00
parent 8e6883f8f0
commit 8830950f85
13 changed files with 137 additions and 28 deletions
+16 -2
View File
@@ -3,6 +3,7 @@
#include <QFile>
#include <QApplication>
#include <QPalette>
#include <QDateTime>
#include "utility.h"
@@ -91,6 +92,16 @@ void CANFrameModel::setSecondsMode(bool mode)
}
}
void CANFrameModel::setSysTimeMode(bool mode)
{
if (useSystemTime != mode)
{
this->beginResetModel();
useSystemTime = mode;
this->endResetModel();
}
}
void CANFrameModel::setInterpetMode(bool mode)
{
//if the state of interpretFrames changes then we need to reset the model
@@ -237,8 +248,11 @@ QVariant CANFrameModel::data(const QModelIndex &index, int role) const
switch (index.column())
{
case 0: //timestamp
if (!timeSeconds) return QString::number(thisFrame.timestamp);
else return QString::number((double)thisFrame.timestamp / 1000000.0, 'f', 6);
if (!useSystemTime) {
if (!timeSeconds) return QString::number(thisFrame.timestamp);
else return QString::number((double)thisFrame.timestamp / 1000000.0, 'f', 6);
}
else return QDateTime::fromMSecsSinceEpoch(thisFrame.timestamp / 1000).toString("MMM-dd HH:mm:ss.zzz");
break;
case 1: //id
return Utility::formatNumber(thisFrame.ID);