about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@gmail.com>2015-08-07 12:54:49 -0700
committerSteven Fackler <sfackler@gmail.com>2015-08-10 20:04:22 -0400
commite29a62f140f3bda4220b47e04623b5a7c7e3e736 (patch)
treef8d0f3b71167c0e9529546b85834d43947e15ebf
parent999bdeca88a06938ac1e1c608091d3afe4d7e173 (diff)
downloadrust-e29a62f140f3bda4220b47e04623b5a7c7e3e736.tar.gz
rust-e29a62f140f3bda4220b47e04623b5a7c7e3e736.zip
Add back and deprecate old methods.
-rw-r--r--src/libstd/time/duration.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs
index ee287484256..c63bd275ffc 100644
--- a/src/libstd/time/duration.rs
+++ b/src/libstd/time/duration.rs
@@ -96,6 +96,14 @@ impl Duration {
     #[stable(feature = "duration", since = "1.3.0")]
     pub fn as_secs(&self) -> u64 { self.secs }
 
+    #[deprecated(reason = "renamed to `as_secs`", since = "1.3.0")]
+    #[unstable(feature = "duration_deprecated")]
+    /// Returns the number of whole seconds represented by this duration.
+    ///
+    /// The extra precision represented by this duration is ignored (e.g. extra
+    /// nanoseconds are not represented in the returned value).
+    pub fn secs(&self) -> u64 { self.as_secs() }
+
     /// Returns the nanosecond precision represented by this duration.
     ///
     /// This method does **not** return the length of the duration when
@@ -103,6 +111,15 @@ impl Duration {
     /// fractional portion of a second (e.g. it is less than one billion).
     #[stable(feature = "duration", since = "1.3.0")]
     pub fn subsec_nanos(&self) -> u32 { self.nanos }
+
+    #[deprecated(reason = "renamed to `subsec_nanos`", since = "1.3.0")]
+    #[unstable(feature = "duration_deprecated")]
+    /// Returns the nanosecond precision represented by this duration.
+    ///
+    /// 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 (e.g. it is less than one billion).
+    pub fn extra_nanos(&self) -> u32 { self.subsec_nanos() }
 }
 
 impl Add for Duration {