Skip to content

Commit aa10fce

Browse files
committed
Update Duration::from_secs doc example to show underlying values.
1 parent 0634f0a commit aa10fce

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libstd/time/duration.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ impl Duration {
8484
/// ```
8585
/// use std::time::Duration;
8686
///
87-
/// let five_seconds = Duration::from_secs(5);
87+
/// let duration = Duration::from_secs(5);
88+
///
89+
/// assert_eq!(5, duration.as_secs());
90+
/// assert_eq!(0, duration.subsec_nanos());
8891
/// ```
8992
#[stable(feature = "duration", since = "1.3.0")]
9093
#[inline]

0 commit comments

Comments
 (0)