forked from google/cctz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Breakdown the "seconds + femtoseconds => time_point" overflow issue.
When `cctz::parse()` produces seconds+femtoseconds values that cannot be represented in the output `time_point<D>` it should return `false`. Here we add overloads of `join_seconds()` that break the overflow issue down into four cases, three of which are implemented and have test cases. The fourth overload (for 1/N duration ratios) is yet to be implemented, so its test cases are currently commented out, but they provide a guide to what remains to be done. See google#199. Also, clarify that the `ToUnixSeconds()` implementation requires that the `std::chrono::system_clock` uses the Unix epoch in order to avoid arithmetic overflow.
- Loading branch information
Showing
3 changed files
with
172 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters