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

Fixes a bug when using Instant - Duration #2

Merged
merged 2 commits into from
Oct 14, 2020
Merged

Fixes a bug when using Instant - Duration #2

merged 2 commits into from
Oct 14, 2020

Conversation

andyHa
Copy link
Contributor

@andyHa andyHa commented Oct 14, 2020

When calling Instant::now() - Duration::from_secs(1) we expect the same result
as when calling Instant::now().checked_sub(Duration::from_secs(1)). However,
as Sub::sub for Instant calls checked_add instead we got a wrong result.

This patch will fix the bug.

The current implementation invoked checked_add which
is the inverse actually.
@museun
Copy link
Owner

museun commented Oct 14, 2020

Looks good, just a silly copy-paste error when I was implementing all of the operators. Thanks

@museun museun merged commit a7436b6 into museun:master Oct 14, 2020
@andyHa andyHa deleted the patch-1 branch October 14, 2020 14:27
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.

2 participants