Jan. 11, 2008
10:59 p.m.
"Jonathan Leffler" <jonathan.leffler@gmail.com> writes:
I guess the POSIX manual allows this
POSIX is incoherent in this area. It places hardly any requirements on localtime_r; for example, localtime_r can be an alias for gmtime_r. I think the intent is that localtime_r have read-only access to the internal data that tzset initializes. However, there's no clear POSIX requirement on the application to call tzset before calling localtime_r, nor there is any requirement on the implementation to behave as if tzset were called before execution begins. Since the standard is fuzzy in this area, portable code should invoke tzset (or localtime or mktime or strftime) before invoking localtime_r.