Tracking Issue for `Duration::as_millis_{f64,f32}`
Open
Nobody has claimed this yet.
C-tracking-issue
T-libs
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Feature gate: #![feature(duration_millis_float)]
This is a tracking issue for
Duration::as_millis_f64Duration::as_millis_f32
Public API
impl Duration {
/// Returns the number of milliseconds contained by this `Duration` as `f64`.
///
/// The returned value does include the fractional (nanosecond) part of the duration.
///
/// # Examples
/// ```
/// use std::time::Duration;
///
/// let dur = Duration::new(2, 67_890_000);
/// assert_eq!(dur.as_millis_f64(), 2678.9);
/// ```
pub const fn as_millis_f64(self);
/// Returns the number of milliseconds contained by this `Duration` as `f32`.
///
/// The returned value does include the fractional (nanosecond) part of the duration.
///
/// # Examples
/// ```
/// use std::time::Duration;
///
/// let dur = Duration::new(2, 67_890_000);
/// assert_eq!(dur.as_millis_f32(), 2678.9);
/// ```
pub const fn as_millis_f32(self);
}
Steps / History
- ACP: https://github.com/rust-lang/libs-team/issues/349
- Implementation: https://github.com/rust-lang/rust/pull/122479
- Related lint: https://github.com/rust-lang/rust-clippy/pull/12539
- Final comment period (FCP)^1
- Stabilization PR
Unresolved Questions
- The implementation is using floating-point division; would we be ok with changing it to multiplication-by-reciprocal at the cost of a ½ULP but being faster?
as_secs_f32uses division, so maybe not.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the public API and the linked implementation PR first, then read the feature-lifecycle stabilization guide referenced by the issue. The remaining work is the final comment period and a stabilization PR; the unresolved question about floating-point division versus multiplication by a reciprocal also needs resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100