-// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
#![stable(feature = "duration_core", since = "1.25.0")]
//! Temporal quantification.
///
/// This method does **not** return the length of the duration when
/// represented by milliseconds. The returned number always represents a
- /// fractional portion of a second (i.e. it is less than one thousand).
+ /// fractional portion of a second (i.e., it is less than one thousand).
///
/// # Examples
///
///
/// This method does **not** return the length of the duration when
/// represented by microseconds. The returned number always represents a
- /// fractional portion of a second (i.e. it is less than one million).
+ /// fractional portion of a second (i.e., it is less than one million).
///
/// # Examples
///
///
/// This method does **not** return the length of the duration when
/// represented by nanoseconds. The returned number always represents a
- /// fractional portion of a second (i.e. it is less than one billion).
+ /// fractional portion of a second (i.e., it is less than one billion).
///
/// # Examples
///
/// # Examples
///
/// ```
- /// # #![feature(duration_as_u128)]
/// use std::time::Duration;
///
/// let duration = Duration::new(5, 730023852);
/// assert_eq!(duration.as_millis(), 5730);
/// ```
- #[unstable(feature = "duration_as_u128", issue = "50202")]
+ #[stable(feature = "duration_as_u128", since = "1.33.0")]
#[inline]
pub const fn as_millis(&self) -> u128 {
self.secs as u128 * MILLIS_PER_SEC as u128 + (self.nanos / NANOS_PER_MILLI) as u128
/// # Examples
///
/// ```
- /// # #![feature(duration_as_u128)]
/// use std::time::Duration;
///
/// let duration = Duration::new(5, 730023852);
/// assert_eq!(duration.as_micros(), 5730023);
/// ```
- #[unstable(feature = "duration_as_u128", issue = "50202")]
+ #[stable(feature = "duration_as_u128", since = "1.33.0")]
#[inline]
pub const fn as_micros(&self) -> u128 {
self.secs as u128 * MICROS_PER_SEC as u128 + (self.nanos / NANOS_PER_MICRO) as u128
/// # Examples
///
/// ```
- /// # #![feature(duration_as_u128)]
/// use std::time::Duration;
///
/// let duration = Duration::new(5, 730023852);
/// assert_eq!(duration.as_nanos(), 5730023852);
/// ```
- #[unstable(feature = "duration_as_u128", issue = "50202")]
+ #[stable(feature = "duration_as_u128", since = "1.33.0")]
#[inline]
pub const fn as_nanos(&self) -> u128 {
self.secs as u128 * NANOS_PER_SEC as u128 + self.nanos as u128