[RFC PATCH 3/4] linux: consistently use time64 syscalls if available
Arnd Bergmann
arnd@arndb.de
Tue Nov 10 16:15:17 GMT 2026
On Tue, Nov 10, 2026, at 17:10, Paul Eggert wrote:
> On 2026-11-10 06:51, Arnd Bergmann wrote:
>> + struct __timespec64 timeout_ts;
>> + struct __timespec64 *timeout_ts_p = NULL;
>> +
>> + if (timeout >= 0)
>> + {
>> + timeout_ts.tv_sec = timeout / 1000;
>> + timeout_ts.tv_nsec = (timeout % 1000) * 1000000;
>> + timeout_ts_p = &timeout_ts;
>> + }
>
> Simpler and clearer is something like this:
>
> struct __timespec64 *timeout_ts_p
> = (timeout < 0 ? NULL
> : &(struct __timespec64) { .tv_sec = timeout / 1000,
> .tv_nsec = timeout % 1000 * 1000000 });
I copied the code from the 'struct timespec' version directly
below it, as it seem best to keep them in sync. I could add a patch
to change the existing code to the style you suggested, but
it doesn't seem to fit in my series. Is it ok to just leave
what I have?
Arnd
More information about the Libc-alpha
mailing list