1
Fork 0

std: Redesign Duration, implementing RFC 1040

This commit is an implementation of [RFC 1040][rfc] which is a redesign of the
currently-unstable `Duration` type. The API of the type has been scaled back to
be more conservative and it also no longer supports negative durations.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1040-duration-reform.md

The inner `duration` module of the `time` module has now been hidden (as
`Duration` is reexported) and the feature name for this type has changed from
`std_misc` to `duration`. All APIs accepting durations have also been audited to
take a more flavorful feature name instead of `std_misc`.

Closes #24874
This commit is contained in:
Alex Crichton 2015-04-28 11:40:04 -07:00
parent 05d5fcaa5b
commit 556e76bb78
26 changed files with 380 additions and 637 deletions

View file

@ -10,17 +10,8 @@
//! Temporal quantification.
#![unstable(feature = "std_misc")]
use sys::time::SteadyTime;
#![unstable(feature = "time")]
pub use self::duration::Duration;
pub mod duration;
/// Returns the current value of a high-resolution performance counter
/// in nanoseconds since an unspecified epoch.
// NB: this is intentionally not public, this is not ready to stabilize its api.
fn precise_time_ns() -> u64 {
SteadyTime::now().ns()
}
mod duration;