Look at "man clock_gettime" which has more detail.
For your project, look at the section "Dynamic clocks" where the example is PTP ...
For your project, look at the section "Dynamic clocks" where the example is PTP ...
Code:
#define CLOCKFD 3#define FD_TO_CLOCKID(fd) ((~(clockid_t) (fd) << 3) | CLOCKFD)#define CLOCKID_TO_FD(clk) ((unsigned int) ~((clk) >> 3))struct timespec ts;int fd = open("/dev/ptp0", O_RDWR);clockid_t clkid = FD_TO_CLOCKID(fd);clock_gettime(clkid, &ts);Statistics: Posted by jahboater — Mon Mar 31, 2025 10:18 am