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

Conversion to/from Duration from std library. #58

Closed
dpc opened this issue Jan 18, 2016 · 9 comments
Closed

Conversion to/from Duration from std library. #58

dpc opened this issue Jan 18, 2016 · 9 comments

Comments

@dpc
Copy link

dpc commented Jan 18, 2016

RIght now the state of things is rather weird, where there are two different Duration types.

@lifthrasiir lifthrasiir self-assigned this Jan 18, 2016
@marjakm
Copy link

marjakm commented Feb 19, 2016

+1

@dbrgn
Copy link
Contributor

dbrgn commented Mar 29, 2016

Could we switch from re-exporting the external time::Duration to using std::time::Duration directly?

@dtolnay
Copy link
Contributor

dtolnay commented Sep 2, 2016

@pantaloons and I just ran into this in #serde. The standard library std::time::Duration works with Serde but time::Duration (and therefore chrono::Duration) does not.

@lifthrasiir
Copy link
Contributor

This is a non-trivial breaking change that is planned in 0.3. In part, std::time::Duration is never negative while time::Duration allows negative; this requires minor but significant interface changes. For now you need to use time::Duration::{from,to}_std methods to convert between them.

@Procrat
Copy link

Procrat commented May 27, 2017

I would like to be able to use the implementation of the Hash trait, which is defined for std::time::Duration, but which apparently is not available for chrono::Duration.

@mqudsi
Copy link
Contributor

mqudsi commented Aug 2, 2017

Is it possible to drop time::Duration entirely now that there is a stable std::time::Duration? Is there a roadmap for std compatibility?

@H2CO3
Copy link

H2CO3 commented Aug 6, 2017

@lifthrasiir What is the state of this? Chrono is already at 0.4 yet the usage of (old)time::Duration remains prevalent. It would be really good if it weren't a pain to use one of Chrono's core data types. Also the dependence on (old)time and rustc-serialize seems dubious: those libraries are deprecated and are no longer supported. As such, they should not be depended upon.

@0xpr03
Copy link

0xpr03 commented Aug 25, 2017

This really is a hassle now, I can't convert a NaiveTime to a Duration at all and the 0.4 broke my workaround (which was essentially to just do some meaningless calculation-function which returned the right type). Now we've a golden cage state..

@pitdicker
Copy link
Collaborator

Closing as a duplicate of #497.

@pitdicker pitdicker closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2023
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

No branches or pull requests

10 participants