[tz] [libc-coord] thread-safe localtime() for an arbitrary timezone

Paul Gilmartin PaulGBoulder at AIM.com
Wed Jun 21 02:16:23 UTC 2023


( the Archives of this thread seem incomplete.)

On 6/20/23 15:00:29, enh via tz wrote:
>     ...
>     We could rename 'struct state', but I'm a bit lost as to what the
>     problem is, as I don't see mention of 'state' or 'timezone_t' in
>     openbsd/lib/libc/time/wcsftime.c. Although there is a 'struct state' in
>     openbsd/lib/libc/time/localtime.c I assume you're replacing that with
>     tzcode's localtime.c somehow.

(Replying mostly to the Subject:)
A thread-safe localtime() seems impractical. localtime() depends
on the environment variable TZ.  If concurrent threads set
different values of TZ the results will be unpredictable.  The
same applies to localtime_r().

-- 
gil




More information about the tz mailing list