This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: localtime_r does not call tzset
The original idea of calling tzset automatically was a botch,
as it slows down performance on multithreaded
implementations if two threads call tzset simultaneously.
POSIX wisely does not require this botch for localtime_r;
the botch is required only for ancient parts of the API,
such as localtime, where old applications may depend on
the botch.
Portable code cannot depend on localtime_r invoking the
equivalent of tzset. Some implementations do it (typically
the slower ones :-), and some don't. It's easy to avoid
the problem portably: just call tzset before creating
any threads that call localtime_r.