Skip to content

Commit 0d2fbff

Browse files
committed
Crummy fix for negative timestamps bug found in older versions of SavvyCAN. Without this fix all timestamps get imported as 0.
1 parent 06bed25 commit 0d2fbff

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

framefileio.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -2107,7 +2107,12 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector<CANFrame>* frames)
21072107
{
21082108
if (tokens[0].length() > 3)
21092109
{
2110-
thisFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, tokens[0].toULongLong()));
2110+
qint64 ts = tokens[0].toLongLong();
2111+
//this next line somewhat hamfistedly fixes a bug where older versions of savvycan would save captures
2112+
//with negative timestamps if you use system clock mode. With this line you'll at least get timestamps
2113+
//though they won't be correlated to the system clock any longer.
2114+
//if (ts < 0) ts = (ts & 0xFFFFFFFFFFFFFF); //mask off top byte
2115+
thisFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, ts));
21112116
}
21122117
else
21132118
{

0 commit comments

Comments
 (0)