Proposal: API for thread-safe time zone functions

Jonathan Lennox lennox at
Fri Jun 8 05:14:43 UTC 2001

On Thursday, June 7 2001, "Garrett Wollman" wrote to "Paul Eggert, tz at" saying:

> <<On Thu, 7 Jun 2001 13:44:48 -0700 (PDT), Paul Eggert <eggert at> said:
> > It doesn't worry about threads, so it mishandles this case: two
> > different threads can clobber the same internal structure.
> > I don't offhand know what other systems do.
> At least in FreeBSD, these functions are serialized for thread
> safety.  (That's one of the reasons we haven't updated to a recent
> tzcode in years.)  Obviously, functions like localtime() which return
> static buffers can never be made thread-safe.

Actually, localtime() can be made thread-safe -- it you just have to return
a pthread_getspecific() buffer rather than a static buffer.

And in fact, this is exactly what FreeBSD does.

What I think you meant is that localtime() can't be made *reentrant*?

Jonathan Lennox
lennox at

More information about the tz mailing list