Without an explicitly specified clock id, lsclocks would always use
clock id 0 (CLOCK_REALTIME) for the dynamic/PTP clocks.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
#include "all-io.h"
#include "list.h"
+#define CLOCKFD 3
+
+static inline clockid_t FD_TO_CLOCKID(int fd)
+{
+ return (~(unsigned int) fd << 3) | CLOCKFD;
+}
+
#ifndef CLOCK_REALTIME
#define CLOCK_REALTIME 0
#endif
struct clockinfo clockinfo = {
.type = CT_PTP,
+ .id = FD_TO_CLOCKID(fd),
.no_id = true,
.id_name = path,
.name = path,