Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Arbitrary::arbitrary for SystemTime not panic #322

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

neithernut
Copy link

Arbitrary SystemTimes are generated based on arbitrary Durations by adding or subtracting from UNIX_EPOCH. If we happen to generate big Durations, this could cause an overflow.

This change avoids this problem by resorting to ever smaller durations in case of an overflow.

Fixes #321.

Arbitrary `SystemTime`s are generated based on arbitrary `Duration`s by
adding or subtracting from `UNIX_EPOCH`. If we happen to generate big
`Duration`s, this could cause an overflow.

This change avoids this problem by resorting to ever smaller durations
in case of an overflow.
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.

Durations's Arbitrary instance is dependant on Gen's size
1 participant