Defect report from : Jonathan Lennox , Columbia University
(Please direct followup comments direct to yyyyyyyyyyyyyy@xxxxxxxxxxxxx)
@ page 1926 line 44451 section strftime() comment {2}
Problem:
Defect code : 2. Omission
(This is an update for the revised POSIX specification of PASC
interpretation request #135 against 1003.1-1996.)
The specification is unclear on the meaning of the %Z and %z
strftime() specifiers, in some circumstances. This is an area which
multiple Unix systems implement differently.
1. The specification is unclear on what happens to existing
local-time-related data, when the environment variable 'TZ' is
changed.
In particular, the indended result is unclear in the following
situation:
* mktime(), localtime(), or localtime_r() create or modify a
'struct tm' value.
* The 'TZ' environment variable is altered.
* strftime() is called with the %Z or %z conversion specifiers,
with the old 'struct tm' as an argument.
Some Unix platforms store time zone information in private fields
within a 'struct tm', and thus output the old time zone. Some use
a global variable, and thus output the new time zone. Some platforms
store a pointer to a current time zone object, and thus may output
invalid data.
2. Similarly, the correct behavior of the %Z and %z conversion
specifiers of strftime() is unclear for 'struct tm' values
representing UTC times. If a struct tm is created or altered
by gmtime() or gmtime_r(), it is not clear whether strftime() should
output a representation of the name or offset of the current local
time zone, or a representation of Coordinated Universal Time in the
current locale.
Again, Unix platforms behave differently on this issue, depending on
whether time zone information is stored inside struct tm.
Action:
Add the following text, highlighted with a CX indicator, to the
descriptions of the %Z and %z strftime conversion specifiers
(or else elsewhere within the description of strftime().)
If a 'struct tm' broken-down time structure is created by localtime()
or localtime_r(), or modified by mktime(), and the value of TZ is
subsequently modified, the results of the %Z and %z strftime()
conversion specifiers is undefined, when strftime() is called with
such a broken-down time structure.
If the broken-down time structure is subsequently modified by a
successful call to mktime() or localtime_r(), the results of these
conversion specifiers are once again defined.
If a 'struct tm' broken-down time structure is created or modified
by gmtime() or gmtime_r(), it is undefined whether the result of the
%Z and %z conversion specifiers shall refer to UTC or the current
local time zone, when strftime() is called with such a broken-down
time structure.
|