Re: [PATCH 03/12] pthread_getcpuclockid.3: Cast 'time_t' to 'intmax_t' for printf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Michael,

On 9/13/20 8:05 AM, Michael Kerrisk (man-pages) wrote:
> Hi Alex,
>
> On 9/13/20 7:58 AM, Michael Kerrisk (man-pages) wrote:
>> Hi Alex,
>>
>> On 9/12/20 1:14 AM, Alejandro Colomar wrote:
>>> Signed-off-by: Alejandro Colomar <colomar.6.4.3@xxxxxxxxx>
>>> ---
>>>  man3/pthread_getcpuclockid.3 | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> Casting to long is the historical practive here, and should be
sufficient,
>> don't you think?
>
> Oh -- I see Jakub made a similar comment for patch 08.
>
> Do you want to redraft this patch too?
>
> Thanks,
>
> Michael
>

The thing in patch 08 is that the numbers were modulo very small
numbers, and therefore very small numbers:

> -    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);

In this case it doesn't apply.

Cheers,

Alex



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux