mirror of https://github.com/mkerrisk/man-pages
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:
parent
b5cd247069
commit
fb84ed2aae
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue