@@ -96,13 +96,30 @@ impl Duration {
9696 #[ stable( feature = "duration" , since = "1.3.0" ) ]
9797 pub fn as_secs ( & self ) -> u64 { self . secs }
9898
99+ #[ deprecated( reason = "renamed to `as_secs`" , since = "1.3.0" ) ]
100+ #[ unstable( feature = "duration_deprecated" ) ]
101+ /// Returns the number of whole seconds represented by this duration.
102+ ///
103+ /// The extra precision represented by this duration is ignored (e.g. extra
104+ /// nanoseconds are not represented in the returned value).
105+ pub fn secs ( & self ) -> u64 { self . as_secs ( ) }
106+
99107 /// Returns the nanosecond precision represented by this duration.
100108 ///
101109 /// This method does **not** return the length of the duration when
102110 /// represented by nanoseconds. The returned number always represents a
103111 /// fractional portion of a second (e.g. it is less than one billion).
104112 #[ stable( feature = "duration" , since = "1.3.0" ) ]
105113 pub fn subsec_nanos ( & self ) -> u32 { self . nanos }
114+
115+ #[ deprecated( reason = "renamed to `subsec_nanos`" , since = "1.3.0" ) ]
116+ #[ unstable( feature = "duration_deprecated" ) ]
117+ /// Returns the nanosecond precision represented by this duration.
118+ ///
119+ /// This method does **not** return the length of the duration when
120+ /// represented by nanoseconds. The returned number always represents a
121+ /// fractional portion of a second (e.g. it is less than one billion).
122+ pub fn extra_nanos ( & self ) -> u32 { self . subsec_nanos ( ) }
106123}
107124
108125impl Add for Duration {
0 commit comments