clock_getres.2: Cast 'time_t' to 'int' for printf() and fix the length modifiers

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Reviewed-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Alejandro Colomar 2020-09-12 12:06:41 +02:00 committed by Michael Kerrisk
parent f6fbffeae5
commit 6fd153d540
1 changed files with 4 additions and 2 deletions

View File

@ -491,8 +491,10 @@ displayClock(clockid_t clock, char *name, bool showRes)
if (days > 0)
printf("%ld days + ", days);
printf("%2ldh %2ldm %2lds", (ts.tv_sec % SECS_IN_DAY) / 3600,
(ts.tv_sec % 3600) / 60, ts.tv_sec % 60);
printf("%2dh %2dm %2ds",
(int) (ts.tv_sec % SECS_IN_DAY) / 3600,
(int) (ts.tv_sec % 3600) / 60,
(int) ts.tv_sec % 60);
printf(")\en");
if (clock_getres(clock, &ts) == \-1) {