Skip to content

Conversation

@durka
Copy link
Contributor

@durka durka commented Apr 16, 2017

This PR adds a function to parallel Duration::from_millis, to get the milliseconds back out. It reduces friction when using other APIs that deal in milliseconds, while allowing Rust code to use Duration internally.

Example: I wanted to take in a Duration and pass it as milliseconds to an FFI function that expects an int, and it's messy to implement this function outside of std.

@rust-highfive
Copy link
Contributor

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@nagisa
Copy link
Member

nagisa commented Apr 16, 2017

I believe this was delayed so u128/i128 as a return value could be used (EDIT: no it was to_nanos). Current implementation will panic for large durations.

See also #28404 and #35868

@nagisa nagisa added S-waiting-on-team DEPRECATED: Use the team-based variants `S-waiting-on-t-lang`, `S-waiting-on-t-compiler`, ... T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Apr 16, 2017
@durka
Copy link
Contributor Author

durka commented Apr 16, 2017

OK, from rust-lang/rfcs#1547 it basically sounds like the decision was stalemate. I'll just use chrono.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-team DEPRECATED: Use the team-based variants `S-waiting-on-t-lang`, `S-waiting-on-t-compiler`, ... T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants