Defect report from : Jon Hitchcock , none
(Please direct followup comments direct to yyyyyyyyyyyyyy@xxxxxxxxxxxxx)
@ page 699 line 23037 section localtime objection {jjh72}
Problem:
Defect code : 1. Error
The localtime() function is said to always return a pointer to a broken-
down time structure, and the examples assume this. This conflicts with
the ISO C standard.
The ISO C standard says that localtime() returns a null pointer if the
specified time cannot be converted to local time. There are two reasons
why this might happen:
1) the implementation cannot relate any time_t values to local time,
2) the particular time_t value is invalid.
POSIX.1-1996 relied on the C standard to specify localtime(). But the
current text is based on the old Single Unix Specification, which
(like many Unix man pages) just says that localtime() returns a
pointer to the broken-down time structure. This was probably because:
1) in POSIX, the time_t value is always related to local time by
the "seconds since the Epoch" expression and the timezone
information.
2) with a 32-bit time_t it is impossible to have a value so large
that the corresponding year cannot be held in an int, and the
case of negative values was ignored.
With a 64-bit time_t and a 32-bit tm_year it is possible to get an
error.
Action:
Option 1: Add with CX-shading ", even if an error is detected"
Option 2: Add "If an error is detected, localtime() shall return a null
pointer."
Option 3: Add "If an error is detected, localtime() may return a null
pointer, unless the XSI extension is supported."
Depending on which option is chosen, change the examples at lines
13651, 23054, 23069, 23083, 35939, 43309, 46677, 46696 to check for a
null pointer.
|