-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Lines 169 to 176 in 3fd82a5
#[stable(feature = "duration_extras", since = "1.27.0")] | |
#[inline] | |
pub const fn from_nanos(nanos: u64) -> Duration { | |
Duration { | |
secs: nanos / (NANOS_PER_SEC as u64), | |
nanos: (nanos % (NANOS_PER_SEC as u64)) as u32, | |
} | |
} |
As it turns out, using u64
for Duration::from_nanos
isn't the greatest idea because 2^64 / 1,000,000,000 / 60 / 60 / 24 / 365
comes out to 585 years which is rather short. I don't think the libs team realized how short this was when stabilizing it, but fortunately it hasn't actually hit stable yet and is still in beta so we have the time to reconsider that decision.
cc @SimonSapin who kicked off stabilization in #46507
kennytm and eberkund
Metadata
Metadata
Assignees
Labels
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.