diff options
| author | bors <bors@rust-lang.org> | 2017-09-07 01:04:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-09-07 01:04:34 +0000 |
| commit | 05e3c96d36b5281e969b5e79b92d671c7872bf83 (patch) | |
| tree | f048a1b5964cebc464db1e380af1baa40080b455 /src/libstd/time | |
| parent | 3681220877771954fa923e50f227e632aabe8bbc (diff) | |
| parent | 66670584cf30de5b9a68c0eb8de68c45ee2836a0 (diff) | |
Auto merge of #44380 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 23 pull requests - Successful merges: #44097, #44206, #44218, #44276, #44277, #44296, #44303, #44313, #44315, #44317, #44319, #44321, #44325, #44326, #44327, #44328, #44330, #44351, #44353, #44354, #44361, #44362, #44377 - Failed merges:
Diffstat (limited to 'src/libstd/time')
| -rw-r--r-- | src/libstd/time/mod.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libstd/time/mod.rs b/src/libstd/time/mod.rs index 5b893505b34..e0dd8cfe62e 100644 --- a/src/libstd/time/mod.rs +++ b/src/libstd/time/mod.rs @@ -382,6 +382,17 @@ impl fmt::Debug for SystemTime { /// [`SystemTime`] instance to represent another fixed point in time. /// /// [`SystemTime`]: ../../std/time/struct.SystemTime.html +/// +/// # Examples +/// +/// ```no_run +/// use std::time::{SystemTime, UNIX_EPOCH}; +/// +/// match SystemTime::now().duration_since(UNIX_EPOCH) { +/// Ok(n) => println!("1970-01-01 00:00:00 UTC was {} seconds ago!", n.as_secs()), +/// Err(_) => panic!("SystemTime before UNIX EPOCH!"), +/// } +/// ``` #[stable(feature = "time2", since = "1.8.0")] pub const UNIX_EPOCH: SystemTime = SystemTime(time::UNIX_EPOCH); |
