Skip to content

Commit

Permalink
Crummy fix for negative timestamps bug found in older versions of Sav…
Browse files Browse the repository at this point in the history
…vyCAN. Without this fix all timestamps get imported as 0.
  • Loading branch information
collin80 committed Oct 22, 2024
1 parent 06bed25 commit 0d2fbff
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion framefileio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2107,7 +2107,12 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector<CANFrame>* frames)
{
if (tokens[0].length() > 3)
{
thisFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, tokens[0].toULongLong()));
qint64 ts = tokens[0].toLongLong();
//this next line somewhat hamfistedly fixes a bug where older versions of savvycan would save captures
//with negative timestamps if you use system clock mode. With this line you'll at least get timestamps
//though they won't be correlated to the system clock any longer.
//if (ts < 0) ts = (ts & 0xFFFFFFFFFFFFFF); //mask off top byte
thisFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, ts));
}
else
{
Expand Down

0 comments on commit 0d2fbff

Please sign in to comment.