Bug 204530 - ctime(3): struct tm documentation possibly incorrect
Summary: ctime(3): struct tm documentation possibly incorrect
Status: Open
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
: 204529 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-11-13 19:37 UTC by Michael Cress
Modified: 2024-10-28 08:48 UTC (History)
4 users (show)

See Also:


Attachments
ctime(3) patch (518 bytes, patch)
2021-10-12 03:04 UTC, Felix Johnson
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Cress 2015-11-13 19:37:02 UTC
This bug submission is an FYI regarding another related report I have submitted in the source tracker  against time.h having potentially incorrect range values ( see Bug 204529 - struct tm documentation in time.h possibly incorrect ). Since "man 3 gmtime" contains an excerpt of this struct verbatim, I opened a ticket in the event that Bug 204529 is accurate, which will cause an update to this man page.
Comment 1 Michael Cress 2015-11-13 19:45:37 UTC
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 notation regarding this be added to the gmtime man page to clarify this issue?
Comment 2 Felix Johnson 2021-10-12 03:04:33 UTC
Created attachment 228609 [details]
ctime(3) patch

Document that tm_sec has a range of [0,60] to allow for leap seconds,
and tm_yday has a range of [0,365] to allow for leap years.
Comment 3 Felix Johnson 2021-10-12 03:05:51 UTC
This is a documentation issue, not an implementation issue.
Comment 4 Felix Johnson 2021-10-12 03:06:31 UTC
*** Bug 204529 has been marked as a duplicate of this bug. ***
Comment 5 Alexander Ziaee freebsd_triage 2024-10-28 07:07:49 UTC
Patch is for a contrib/tzcode/stdtime/ctime.3