Skip to content

SystemTime does not discuss leap seconds in docs #77994

Closed
@ijackson

Description

@ijackson

SystemTime ought to explain what happens with leap seconds.

In particular, the current text under SystemTime::UNIX_EPOCH suggests 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_EPOCH constant.

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!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: 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.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions