Skip to content

Tracking issue for duration_float #54361

Closed
@newpavlov

Description

@newpavlov
Contributor

Rust PRs: #52813, #59102

This feature adds the following float related methods to Duration:

  • as_secs_f64(&self) -> f64
  • as_secs_f32(&self) -> f32
  • from_secs_f64(secs: f64) -> Duration
  • from_secs_f32(secs: f32) -> Duration
  • mul_f64(self, rhs: f64) -> Duration
  • mul_f32(self, rhs: f32) -> Duration
  • div_f64(self, rhs: f64) -> Duration
  • div_f32(self, rhs: f64) -> Duration

div_duration methods are tracked in #63139.

Activity

added
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
B-unstableBlocker: Implemented in the nightly compiler and unstable.
on Sep 19, 2018
m-ou-se

m-ou-se commented on Jan 19, 2019

@m-ou-se
Member

What needs to happen before this can be stabilized?

icefoxen

icefoxen commented on Jan 23, 2019

@icefoxen
Contributor

f64 vs f32

The only sane options are "have versions for both", or "f64 because it's more general and people can always downcast." You can't fit a billion nanoseconds into the 24 bit significand of a f32.

Also, yes, what needs to happen for this to stabilize?

newpavlov

newpavlov commented on Jan 23, 2019

@newpavlov
ContributorAuthor

I guess we probably should rename methods to as_f64_secs, from_f64_secs and div_duration_f64, so we will have an option to add analogous f32 methods.

smokytheangel0

smokytheangel0 commented on Feb 15, 2019

@smokytheangel0

What can I do to help?

aloucks

aloucks commented on Feb 23, 2019

@aloucks
Contributor

I guess we probably should rename methods to as_f64_secs, from_f64_secs and div_duration_f64, so we will have an option to add analogous f32 methods.

as_secs_f64 and from_secs_f64 would be more consistent.

added a commit that references this issue on Mar 13, 2019

Rollup merge of rust-lang#59102 - newpavlov:duration_float, r=alexcri…

a7ecf5f
added a commit that references this issue on Mar 13, 2019

Rollup merge of rust-lang#59102 - newpavlov:duration_float, r=alexcri…

7787734
added a commit that references this issue on Mar 14, 2019

Rollup merge of rust-lang#59102 - newpavlov:duration_float, r=alexcri…

e113402
added 2 commits that reference this issue on Mar 15, 2019

Rollup merge of rust-lang#59102 - newpavlov:duration_float, r=alexcri…

348ee6d

17 remaining items

shadiakiki1986

shadiakiki1986 commented on Feb 12, 2020

@shadiakiki1986

For future-comers, upgrading to rustc>=1.38 fixes this

added a commit that references this issue on Jan 3, 2021
a015369
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @alexcrichton@ghedo@aloucks@newpavlov@faern

      Issue actions

        Tracking issue for duration_float · Issue #54361 · rust-lang/rust