Copyright © 2006 IEEE. All rights reserved.
Interpretation Number: 041
Topic: strptime leading zeroes
Relevant Sections: XSH strptimeAustin Group Interpretation Request: ------------------------------------
Date: Sat, 28 Aug 2004 00:04:38 +0100 (BST)
------------------------------------------------------------------------
7 Defect Report concerning (number and title of International Standard or DIS final text, if applicable):
The System Interfaces Volume of IEEE Std 1003.1-2001
------------------------------------------------------------------------
8 Qualifier (e.g. error, omission, clarification required):
3. Clarification required
------------------------------------------------------------------------
9 References in document (e.g. page, clause, figure, and/or table numbers):
Page: 1460 Line: 45510 Section: strptime
XSHbug2.txt Enhancement Request Number 55
------------------------------------------------------------------------
10 Nature of defect (complete, concise explanation of the perceived problem):
The standard states in several places
"leading zeros are permitted but not required."
It also provides patterns, such as: "The hour (24-hour clock) [00,23];"
Are the number of leading zeroes restricted to the width suggested by the pattern?
For example, is 0012 a valid month?
glibc developers consider it appropriate behavior to forbid excess leading zeroes. When trying to parse a given input against several format strings, forbidding excess leading zeroes could be helpful. For example, if one matches 0011-12-26 against %m-%d-%Y and then against %Y-%m-%d, it seems useful for the first match to fail, as it would be perverse to parse that date as November 12, year 26. The second pattern parses it as December 26, year 11.
The LSB explicitly allows implementations to have either behavior. Future versions of that standard may require implementations to forbid excess leading zeroes.
------------------------------------------------------------------------
11 Solution proposed by the submitter (optional):
This is an interpretation request.
"The standard is unclear on this issue, and no conformance distinction can be made between alternative implementations based on this. This is being referred to the sponsor."
Note to sponsor for a future revision:
Limit the number of leading zeroes to the maximum field width for the concersion specified.
Add the following sentence at line 45496, after "... between any two conversion specifications."
"In the following list, where numeric ranges of values are given (represented by the pattern [x,y]), the value shall fall within the range given, and the value shall have at most the same number of characters as the pattern."
------------------------------------------------------------------------
Interpretation response ------------------------
The standard is unclear and no conformance distinction can be made between different implementations because of this. Rationale: ------------- None.
Back to IEEE Standards Interpretations for IEEE Std 1003.1-2001