In time.h: struct tm { int tm_sec; /* seconds after the minute [0-60] */ int tm_min; /* minutes after the hour [0-59] */ int tm_hour; /* hours since midnight [0-23] */ int tm_mday; /* day of the month [1-31] */ int tm_mon; /* months since January [0-11] */ int tm_year; /* years since 1900 */ int tm_wday; /* days since Sunday [0-6] */ int tm_yday; /* days since January 1 [0-365] */ int tm_isdst; /* Daylight Savings Time flag */ long tm_gmtoff; /* offset from UTC in seconds */ char *tm_zone; /* timezone abbreviation */ }; Is the documentation for tm_sec and tm_yday accurate? The range [0-60] for tm_sec yeilds 61 values and [0-365] yields 366 values. Since other values are in sensible ranges (e.g. tm_min -> [0-59]), I'm thinking this is an error. "man 3 gmtime" shows this same struct as well but makes no mention of these ranges being special cases.
Looking at time.h on Linux, I see struct tm { int tm_sec; /* Seconds. [0-60] (1 leap second) */ . . . int tm_yday; /* Days in year.[0-365] */ . . } So, it seems the 0-60 range is due to a leap second. I am assuming that the 0-365 range is due to leap year range also. Can the struct time be modified to include documentation about this for tm_sec and tm_yday?
*** This bug has been marked as a duplicate of bug 204530 ***