Jan. 11, 2008
6 a.m.
"Jonathan Leffler" <jonathan.leffler@gmail.com> writes:
Actually, the subject pretty much says it all. In tzcode2007k (also in 2007h), the code in localtime.c is:
struct tm * localtime(const time_t *const timep) { tzset(); return localsub(timep, 0L, &tm); }
struct tm * localtime_r(const time_t *const timep, struct tm *tmp) { return localsub(timep, 0L, tmp); }
I can't immediately see a justification for the asymmetry in the POSIX specification of these functions, but I could be missing something.
My guess is it's because tzset() sets global variables and hence isn't threadsafe. -- Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>