Kvaser Linux CANLIB
|
The accuracy of the time stamps depends on the hardware.
The members of the Kvaser Leaf family have an onboard CPU. The time stamp accuracy varies (check the hardware manual) but the high-end members have very precise time stamping. The accuracy can be as good as one microsecond depending on the hardware. If more than one Leaf is used, their clocks are automatically kept in sync by the Kvaser MagiSync™ technology.
Other CAN interfaces, like the Kvaser Leaf, LAPcan and USBcan II, have an on-board CPU and clock and provide very accurate time stamps for incoming CAN messages. The accuracy is typically 10-20 microseconds.
Certain interfaces, like the PCIcan (PCI) series of boards, don't have an on-board CPU so the driver relies on the clock in the PC to timestamp the incoming messages. As Windows is not a real-time operating system, this gives an accuracy which is in the order of one millisecond.
The resolution of the time stamps is, by default, 1 ms. It can be changed by calling canIoCtl() with the canIOCTL_SET_TIMER_SCALE function code.
LAPcan uses an on-board clock for creating the message time stamps. The resolution of this clock is 8 microseconds. The accuracy of the time stamps can vary from around 8 microseconds up to 100 microseconds, depending on the bus load and if you have one or two CAN busses connected. If two messages arrive at the same time, but on different busses, to LAPcan, the message on channel 1 will be handled first and will have the most accurate time stamp. The time stamp on the second message will be up to 100 microseconds "too late".
PCcan and PCIcan do not have an on-board clock but uses the PC clock instead. On certain types of PCs, the on-board clock can jump forward with random intervals. The amount of time added to the clock is one to a few seconds. This is due to a bug in the PC hardware. For more information, check out Microsoft Knowledgebase Q274323. (The URL was, as of this writing, http://support.microsoft.com/kb/q274323/)