diff --git a/src/libstd/time/mod.rs b/src/libstd/time/mod.rs index 5b893505b34d2..f0f70ac6e9eb0 100644 --- a/src/libstd/time/mod.rs +++ b/src/libstd/time/mod.rs @@ -382,6 +382,18 @@ 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}; +/// +/// let now = match SystemTime::now().duration_since(UNIX_EPOCH) { +/// Ok(n) => n, +/// Err(_) => panic!("SystemTime before UNIX EPOCH!"), +/// }; +/// println!("1970-01-01 00:00:00 UTC was {} seconds ago!", now.as_secs()); +/// ``` #[stable(feature = "time2", since = "1.8.0")] pub const UNIX_EPOCH: SystemTime = SystemTime(time::UNIX_EPOCH);