From e2cedf2482eef91f31155018e4a523c523834500 Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Sun, 28 Feb 2016 16:56:04 -0500 Subject: [PATCH] A small fix to make transmitted frame timestamps a bit more accurate but still not synced to capture device. --- serialworker.cpp | 3 +++ serialworker.h | 1 + 2 files changed, 4 insertions(+) diff --git a/serialworker.cpp b/serialworker.cpp index b36940e..33ea8db 100644 --- a/serialworker.cpp +++ b/serialworker.cpp @@ -19,6 +19,8 @@ SerialWorker::SerialWorker(CANFrameModel *model, QObject *parent) : QObject(pare isAutoRestart = false; targetID = -1; + txTimestampBasis = QDateTime::currentMSecsSinceEpoch(); + readSettings(); } @@ -157,6 +159,7 @@ void SerialWorker::sendFrame(const CANFrame *frame, int bus = 0) int ID; CANFrame tempFrame = *frame; tempFrame.isReceived = false; + tempFrame.timestamp = ((QDateTime::currentMSecsSinceEpoch() - txTimestampBasis) * 1000); //qDebug() << "Sending out frame with id " << frame->ID; diff --git a/serialworker.h b/serialworker.h index e0730f0..8aea384 100644 --- a/serialworker.h +++ b/serialworker.h @@ -85,6 +85,7 @@ private: bool can0Enabled, can1Enabled; int deviceBuildNum; int deviceSingleWireMode; + uint64_t txTimestampBasis; void procRXChar(unsigned char); void sendCommValidation();