-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
SystemTime does not discuss leap seconds in docs #77994
Copy link
Copy link
Closed
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
SystemTimeought to explain what happens with leap seconds.In particular, the current text under
SystemTime::UNIX_EPOCHsuggests using.duration_since()to get "Using duration_since on an existing SystemTime instance can tell how far away from this point in time a measurement lies".A programmer who is reading this and does not know of the existence of leap seconds will assume that the result is a Unix
time_t(with additional precision). I think this is in fact the case, but this is not stated and it should be.I am filing this as a bug report because the lack of an explicit statement in the documentation makes it impossible to confidently write code which receives or emits unix times, even though that does seem to be the point of the
UNIX_EPOCHconstant.It would probably be useful to mention leap seconds as a reason why the clock might go backwards or might not run at a constant rate, along with clock adjustments (the implications of which are discussed without naming them!)