Skip to content

Commit

Permalink
Merge branch 'lsclocks/ptp' of https://github.com/t-8ch/util-linux
Browse files Browse the repository at this point in the history
* 'lsclocks/ptp' of https://github.com/t-8ch/util-linux:
  lsclocks: fix dynamic clock ids
  • Loading branch information
karelzak committed Dec 26, 2024
2 parents 3645384 + 63102b8 commit 4e14b57
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions misc-utils/lsclocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@
#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
Expand Down Expand Up @@ -380,6 +387,7 @@ static void add_dynamic_clock_from_path(struct libscols_table *tb,

struct clockinfo clockinfo = {
.type = CT_PTP,
.id = FD_TO_CLOCKID(fd),
.no_id = true,
.id_name = path,
.name = path,
Expand Down

0 comments on commit 4e14b57

Please sign in to comment.