File tree 1 file changed +4
-12
lines changed
1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -318,19 +318,11 @@ impl Duration {
318
318
/// assert_eq!(duration.as_secs(), 5);
319
319
/// ```
320
320
///
321
- /// To determine the total number of seconds represented by the `Duration`,
322
- /// use `as_secs` in combination with [`subsec_nanos`]:
323
- ///
324
- /// ```
325
- /// use std::time::Duration;
326
- ///
327
- /// let duration = Duration::new(5, 730023852);
328
- ///
329
- /// assert_eq!(5.730023852,
330
- /// duration.as_secs() as f64
331
- /// + duration.subsec_nanos() as f64 * 1e-9);
332
- /// ```
321
+ /// To determine the total number of seconds represented by the `Duration`
322
+ /// including the fractional part, use [`as_secs_f64`] or [`as_secs_f32`]
333
323
///
324
+ /// [`as_secs_f32`]: Duration::as_secs_f64
325
+ /// [`as_secs_f64`]: Duration::as_secs_f32
334
326
/// [`subsec_nanos`]: Duration::subsec_nanos
335
327
#[ stable( feature = "duration" , since = "1.3.0" ) ]
336
328
#[ rustc_const_stable( feature = "duration_consts" , since = "1.32.0" ) ]
You can’t perform that action at this time.
0 commit comments