[PATCH 2/4] time: Push tzset lock into callers of time functions
Alexander Monakov
amonakov@ispras.ru
Tue Oct 1 17:37:36 GMT 2024
On Tue, 1 Oct 2024, Paul Eggert wrote:
> On 2024-10-01 05:14, Florian Weimer wrote:
> > if (local)
> > return __localtime64_r (&x, tm);
> > else
> > return __gmtime64_r (&x, tm);
>
> Slightly more elegant (and more efficient with gcc -O2 on x86-64 at least, as
> it avoids a conditional branch) is:
>
> return (local ? __localtime64_r : __gmtime64_r) (&x, tm);
On the flip side, in PIC for libc.so this needs a PC-relative computation,
which is not as cheap as amd64's rip-relative lea everywhere.
Alexander
More information about the Libc-alpha
mailing list