Interpretations

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

IEEE Standards Interpretation for IEEE Std 1003.1™-1990 IEEE Standard for Information Technology--Portable Operating System Interfaces (POSIX®)

Copyright © 2001 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 #92
Topic:
Seconds since the epoch Relevant Sections: p25, ll 497-498, clause 2.2.2.113 PASC

IEEE Std 1003.1-1996 contains an error in section 2.2.2.113 which defines the term "seconds since the Epoch". The error is that the expression: tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 + (tm_year-70)*31536000 + ((tm_year-69)/4)*86400 does not correctly account for leap years. It adds one day for every four years, thus disregarding the rule that years divisible by 100 are only leap years if also divisible by 400. The expression produces incorrect values for years 2101 onwards, and so the error could perhaps be called a "Year 2101 bug". Of course, this does not affect implementations with a (signed) 32-bit time_t, which can only represent years up to 2038, and this probably explains why the necessary extra parts of the expression were omitted in the original 1988 standard.

I believe a suitable correction is as follows: tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 + (tm_year-70)*31536000 + ((tm_year-69)/4 - (tm_year-1)/100 + (tm_year+299)/400)*86400

Interpretation Response
The standards states the requirements for seconds since the eopch , and conforming implementations must conform to this. However, concerns have been raised about this which are being referred to the sponsor.

Rationale for Interpretation
None.

Notes to the Project Editor (not part of this interpretation)
The proposed correction in section 11 should be considered for a future revision. Forwarded to Interpretations group: 22 July 1998 Proposed Interpretation: 10 August 1998 Finalised: February 17 1999