Bug 204530

Summary: ctime(3): struct tm documentation possibly incorrect
Product: Documentation Reporter: Michael Cress <michael.cress>
Component: Manual PagesAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me CC: doc, felix.the.red, michael.cress, ziaee
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
ctime(3) patch
none
ctime(3) patch
none
ctime(3) patch none

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_committer freebsd_triage 2024-10-28 07:07:49 UTC
Patch is for a contrib/tzcode/stdtime/ctime.3
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2025-03-01 02:07:38 UTC
Created attachment 258141 [details]
ctime(3) patch

^Triage: rebase patch.
Comment 7 Mark Linimon freebsd_committer freebsd_triage 2025-03-01 02:09:12 UTC
Created attachment 258142 [details]
ctime(3) patch

^Triage: rebase patch.