Defect report from : Jon Hitchcock , none
(Please direct followup comments direct to yyyyyyyyyyyyyy@xxxxxxxxxxxxx)
@ page 577 line 18969 section gmtime objection {jjh71}
Problem:
Defect code : 1. Error
The gmtime() function is said to always return a pointer to a struct
tm. This conflicts with the ISO C standard.
The ISO C standard says that gmtime() returns a null pointer if the
specified time cannot be converted to UTC. There are two reasons
why this might happen:
1) the implementation cannot relate any time_t values to UTC,
2) the particular time_t value is invalid.
POSIX.1-1996 relied on the C standard to specify gmtime(). But the
current text is based on the old Single Unix Specification, which
(like many Unix man pages) just said that gmtime() returns a pointer
to a struct tm. This was probably because:
1) in POSIX, the time_t value is always related to UTC by the
"seconds since the Epoch" expression.
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, gmtime() shall return a null
pointer."
Option 3: Add "If an error is detected, gmtime() may return a null
pointer, unless the XSI extension is supported."
(Note that there is a POSIX interpretation request (PASC 1003.1 #133)
on gmtime_r() which would then make the description of the return
value be the same as option 2.)
|