Get the device timestamp
#include <sys/can_dcmd.h> #define CAN_DEVCTL_GET_TIMESTAMP __DIOF(_DCMD_MISC, CAN_CMD_CODE + 6, uint32_t)
Argument | Value |
---|---|
filedes | A file descriptor that you obtained by opening the device |
dcmd | CAN_DEVCTL_GET_TIMESTAMP |
dev_data_ptr | A pointer to a uint32_t |
n_bytes | sizeof(uint32_t) |
dev_info_ptr | NULL |
This command gets the timestamp.
None.
The timestamp.
int ret; uint32_t val; if( (fd = open( "/dev/can1/rx0", O_RDWR)) == -1 ) { printf("open of %s failed \n", devname); exit(EXIT_FAILURE); } if(EOK != (ret = devctl(fd, CAN_DEVCTL_GET_TIMESTAMP, &val, sizeof(val), NULL))) { fprintf(stderr, "devctl CAN_DEVCTL_GET_TIMESTAMP: %s\n", strerror(ret)); } else { printf("GET_TIMESTAMP = 0x%X\n", val); }