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

timestamp: make saturating arithmetic panic for non-uniform units #46

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

BurntSushi
Copy link
Owner

The saturating methods should return an error. But I goofed on the
API. So at this point, our two choices are: leave it as-is, which
produces completely incorrect results when there are non-zero units of
days or greater, or panic when it occurs. I think a panic is better.

In Jiff 0.2, these APIs will be made fallible. And hopefully by then
we'll have truly infallible APIs that accept an "absolute" duration.

Partially addresses #36

The saturating methods *should* return an error. But I goofed on the
API. So at this point, our two choices are: leave it as-is, which
produces completely incorrect results when there are non-zero units of
days or greater, or panic when it occurs. I think a panic is better.

In Jiff 0.2, these APIs will be made fallible. And hopefully by then
we'll have truly infallible APIs that accept an "absolute" duration.

Partially addresses #36
@BurntSushi BurntSushi force-pushed the ag/i36-timestamp-saturating-panic branch from c34da2b to b918099 Compare July 26, 2024 00:12
@BurntSushi BurntSushi merged commit 29febf0 into master Jul 26, 2024
14 checks passed
@BurntSushi BurntSushi deleted the ag/i36-timestamp-saturating-panic branch July 26, 2024 00:21
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