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

Rename to_jiff_duration methods to to_duration #220

Closed
BurntSushi opened this issue Jan 25, 2025 · 0 comments
Closed

Rename to_jiff_duration methods to to_duration #220

BurntSushi opened this issue Jan 25, 2025 · 0 comments
Labels
breaking change Issues that require a breaking change for resolution.

Comments

@BurntSushi
Copy link
Owner

The to_duration methods were originally added to support std::time::Duration. They were added before I added jiff::SignedDuration.

A jiff::SignedDuration should be the "default" non-calendar duration in Jiff. So to_duration methods should return jiff::SignedDuration.

If callers need a std::time::Duration, they can convert from a jiff::SignedDuration via TryFrom impls.

The to_duration methods were deprecated in jiff 0.1.

@BurntSushi BurntSushi added the breaking change Issues that require a breaking change for resolution. label Jan 25, 2025
BurntSushi added a commit that referenced this issue Jan 25, 2025
This makes the naming with APIs like `Zoned::duration_since` a bit more
consistent. And solidifies `SignedDuration` as Jiff's primary
non-calendar duration type.

I'm open to adding `Span::to_unsigned_duration` in the future, but let's
see how far we can get with what we have. Note that
`TryFrom<Span> for std::time::Duration` still exists, although that of
course only works for non-calendar spans since there is no way to
provide a relative reference time.

Fixes #220
BurntSushi added a commit that referenced this issue Jan 25, 2025
This makes the naming with APIs like `Zoned::duration_since` a bit more
consistent. And solidifies `SignedDuration` as Jiff's primary
non-calendar duration type.

I'm open to adding `Span::to_unsigned_duration` in the future, but let's
see how far we can get with what we have. Note that
`TryFrom<Span> for std::time::Duration` still exists, although that of
course only works for non-calendar spans since there is no way to
provide a relative reference time.

Fixes #220
BurntSushi added a commit that referenced this issue Jan 25, 2025
This makes the naming with APIs like `Zoned::duration_since` a bit more
consistent. And solidifies `SignedDuration` as Jiff's primary
non-calendar duration type.

I'm open to adding `Span::to_unsigned_duration` in the future, but let's
see how far we can get with what we have. Note that
`TryFrom<Span> for std::time::Duration` still exists, although that of
course only works for non-calendar spans since there is no way to
provide a relative reference time.

Fixes #220
BurntSushi added a commit that referenced this issue Jan 27, 2025
This makes the naming with APIs like `Zoned::duration_since` a bit more
consistent. And solidifies `SignedDuration` as Jiff's primary
non-calendar duration type.

I'm open to adding `Span::to_unsigned_duration` in the future, but let's
see how far we can get with what we have. Note that
`TryFrom<Span> for std::time::Duration` still exists, although that of
course only works for non-calendar spans since there is no way to
provide a relative reference time.

Fixes #220
BurntSushi added a commit that referenced this issue Jan 30, 2025
This makes the naming with APIs like `Zoned::duration_since` a bit more
consistent. And solidifies `SignedDuration` as Jiff's primary
non-calendar duration type.

I'm open to adding `Span::to_unsigned_duration` in the future, but let's
see how far we can get with what we have. Note that
`TryFrom<Span> for std::time::Duration` still exists, although that of
course only works for non-calendar spans since there is no way to
provide a relative reference time.

Fixes #220
BurntSushi added a commit that referenced this issue Feb 1, 2025
This makes the naming with APIs like `Zoned::duration_since` a bit more
consistent. And solidifies `SignedDuration` as Jiff's primary
non-calendar duration type.

I'm open to adding `Span::to_unsigned_duration` in the future, but let's
see how far we can get with what we have. Note that
`TryFrom<Span> for std::time::Duration` still exists, although that of
course only works for non-calendar spans since there is no way to
provide a relative reference time.

Fixes #220
BurntSushi added a commit that referenced this issue Feb 2, 2025
This makes the naming with APIs like `Zoned::duration_since` a bit more
consistent. And solidifies `SignedDuration` as Jiff's primary
non-calendar duration type.

I'm open to adding `Span::to_unsigned_duration` in the future, but let's
see how far we can get with what we have. Note that
`TryFrom<Span> for std::time::Duration` still exists, although that of
course only works for non-calendar spans since there is no way to
provide a relative reference time.

Fixes #220
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Issues that require a breaking change for resolution.
Projects
None yet
Development

No branches or pull requests

1 participant