Addition of "System Time" mode where frames are timestamped by
absolute time from the PC clock.
This commit is contained in:
+16
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user