From fb84ed2aae44b6998d4fa5f742032b3c3a755aed Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Wed, 26 Aug 2020 08:10:56 +0200 Subject: [PATCH] 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 Signed-off-by: Michael Kerrisk --- man2/clock_getres.2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man2/clock_getres.2 b/man2/clock_getres.2 index c0e486c2a..8fc7c6fef 100644 --- a/man2/clock_getres.2 +++ b/man2/clock_getres.2 @@ -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