Skip to content
Permalink
Browse files

maybe fix peak timestamps

using one microseconds timestamp, like candle API
  • Loading branch information...
HubertD committed May 16, 2016
1 parent c17255d commit 27d3b7a85787ffb90bd1761b4ce75f503b5b55bc
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/driver/PeakCanDriver/PeakCanInterface.cpp
@@ -212,9 +212,12 @@ bool PeakCanInterface::readMessage(CanMessage &msg, unsigned int timeout_ms)
msg.setByte(i, buf.DATA[i]);
}

uint64_t ms = (uint64_t)timestamp.millis + 0x100000000 * (uint64_t)timestamp.millis_overflow;
ms += _timestampOffset;
msg.setTimestamp(ms/1000, (1000*(ms%1000)) + timestamp.micros);
// Total Microseconds = micros + 1000 * millis + 0x100000000 * 1000 * millis_overflow
uint64_t ts = timestamp.millis;
ts += 0x100000000 * (uint64_t)timestamp.millis_overflow;
ts *= 1000;
ts += timestamp.micros;
msg.setTimestamp(ts/1000000, ts % 1000000);

return true;
} else {

0 comments on commit 27d3b7a

Please sign in to comment.
You can’t perform that action at this time.