We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bdd8e7f commit a3e8f36Copy full SHA for a3e8f36
src/libstd/time/duration.rs
@@ -128,6 +128,21 @@ impl Duration {
128
/// let duration = Duration::new(5, 730023852);
129
/// assert_eq!(duration.as_secs(), 5);
130
/// ```
131
+ ///
132
+ /// To determine the total number of seconds represented by the `Duration`,
133
+ /// use `as_secs` in combination with [`subsec_nanos`]:
134
135
+ /// ```
136
+ /// use std::time::Duration;
137
138
+ /// let duration = Duration::new(5, 730023852);
139
140
+ /// assert_eq!(5.730023852,
141
+ /// duration.as_secs() as f64
142
+ /// + duration.subsec_nanos() as f64 * 1e-9);
143
144
145
+ /// [`subsec_nanos`]: #method.subsec_nanos
146
#[stable(feature = "duration", since = "1.3.0")]
147
#[inline]
148
pub fn as_secs(&self) -> u64 { self.secs }
0 commit comments