[tz] Thread-safe localtime(3) (was Re: Reading binary files)

Garrett Wollman wollman at csail.mit.edu
Wed Nov 2 21:58:18 UTC 2011


<<On Wed, 2 Nov 2011 16:45:00 -0400, Mike Frysinger <vapier at gentoo.org> said:

> POSIX already covers things like localtime().  if people want to extend the 
> time API that is part of the C library, then that discussion should happen on 
> the POSIX mailing lists.

Actually, it's generally the preference of the Austin Group to
standardize existing practice, so the right thing to do is to add
these extensions to tzcode, and then allow the downstream consumers to
add them to their C libraries as they see fit.  Then a proposal can be
written to include them in POSIX (or in the next revision of C, which
is a different standards committee, since they are actually C standard
library functions).

I would very much like to see this happen.  The only quibble I would
make with Christos's proposed API is that, because C does not have
incomplete typedefs, a new foo_t type should not be introduced.  Using
such typedefs creates undesirable ordering dependencies between
headers (not a problem for the Implementation but definitely a problem
for applications if they want to minimize namespace pollution).  Using
an incomplete structure type has all the benefits of a typedef and
none of the drawbacks.  If the proposal is adopted by either C or
POSIX, they will ignore the drawbacks and create a new _t type anyway,
but since they have joint custody of the "_t" namespace, they can at
least guarantee that it's defined in an official system header as
well.

-GAWollman




More information about the tz mailing list