clock_getres.2: Fix type and variable name in dynamic clock code example

Use 'struct timespec', not 'struct timeval', and adjust
the variable name accordingly.

Reported-by: Tony May <tony.may@mediakind.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2020-08-26 08:10:56 +02:00
parent b5cd247069
commit fb84ed2aae
1 changed files with 2 additions and 2 deletions

View File

@ -251,13 +251,13 @@ dynamic clock ID.
#define FD_TO_CLOCKID(fd) ((\(ti(clockid_t) (fd) << 3) | CLOCKFD)
#define CLOCKID_TO_FD(clk) ((unsigned int) \(ti((clk) >> 3))
struct timeval tv;
struct timespec ts;
clockid_t clkid;
int fd;
fd = open("/dev/ptp0", O_RDWR);
clkid = FD_TO_CLOCKID(fd);
clock_gettime(clkid, &tv);
clock_gettime(clkid, &ts);
.EE
.in
.SH RETURN VALUE