]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
clock_getres.2: Fix type and variable name in dynamic clock code example
authorMichael Kerrisk <mtk.manpages@gmail.com>
Wed, 26 Aug 2020 06:10:56 +0000 (08:10 +0200)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Wed, 26 Aug 2020 06:10:56 +0000 (08:10 +0200)
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>
man2/clock_getres.2

index c0e486c2ab3fdfbae9b101addc8bef32ce5425d7..8fc7c6fef8035d6467f45b312b5095f94c87c95b 100644 (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