Skip to content

UTC seems to be treated as canonical; hazardous in the presence of leap seconds #21

Open
@eternaleye

Description

@eternaleye

Chrono seems to treat UTC as the canonical/internal time representation, but this is hazardous because UTC includes leap seconds.

In your Jan 13 rustlog you bring up four issues regarding time zones:

  1. There is no reliable way to handle the local date in the future.
  2. There can exist a local date which occurred in two or more instants.
  3. There can exist a local date which never has been occurred.
  4. The conversion process itself is seriously annoying and easy to make a mistake.

The problem with UTC is that all four of those are true of it as well:

  1. Future leap seconds can be declared at any time, invalidating calculations of future datetimes
  2. Leap seconds as they have occurred so far result in a second that happens twice
  3. Leap seconds can (and eventually will) go in the other direction, resulting in seconds that never happen
  4. Leap second handling is oh so painfully annoying and easy to get wrong

I would suggest instead using TAI, which is the basis of UTC. (UTC is TAI with leap seconds)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions