Skip to content

Conversation

@gmgunter
Copy link
Contributor

This PR adds classes for representing datetimes & timedeltas

  • TimeDelta represents the signed duration between two timepoints with picosecond resolution. It supports integer-like arithmetic operations and can be converted to & from std::chrono::duration. Internally, it stores a 128-bit integer tick count, allowing for representation of an extremely wide range of values without loss of precision.
  • GPSTime is a datetime in the GPS time system. Unlike UTC time, GPS time is a continuous linear time scale -- leap seconds are never inserted. Internally, GPSTime stores a 128-bit integer timestamp with a picosecond tick interval.
  • UTCTime (not yet implemented) represents a datetime in the UTC time system. Leap second augmentations are occasionally applied to account for the difference between time measured by atomic clocks and observed solar time. As a result, the time scale is discontinuous and forecasting into the future may be inaccurate due to the unpredictable timing of UTC leap seconds.
    UTCTime parses the system's IANA timezone database to extract leap second information.

The implementation relies heavily on the <chrono> library as well as Howard Hinnant's date library (which was added to the STL in C++20) for the underlying datetime conversions and arithmetic. In addition, it uses abseil-cpp's int128 type.

@gmgunter gmgunter marked this pull request as draft March 12, 2021 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant