Answering questions that may arise related to the meaning of portions of an IEEE standard concerning specific applications.

IEEE Standards Interpretations for IEEE Std 1003.1™-2001 IEEE Standard for Information Technology - Portable Operating System Interface (POSIX®)

Copyright © 2006 by the Institute of Electrical and Electronics Engineers, Inc. 3 Park Avenue New York, New York 10016-5997 USA All Rights Reserved.

Interpretations are issued to explain and clarify the intent of a standard and do not constitute an alteration to the original standard. In addition, interpretations are not intended to supply consulting information. Permission is hereby granted to download and print one copy of this document. Individuals seeking permission to reproduce and/or distribute this document in its entirety or portions of this document must contact the IEEE Standards Department for the appropriate license. Use of the information contained in this document is at your own risk.

IEEE Standards Department Copyrights and Permissions 445 Hoes Lane, Piscataway, New Jersey 08855-1331, USA

Interpretation Request #41
Topic: strptime leading zeroes Relevant Sections: XSH strptime

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.

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 for Interpretation