We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 088216f commit 1c5bf24Copy full SHA for 1c5bf24
src/libstd/time/mod.rs
@@ -382,6 +382,17 @@ impl fmt::Debug for SystemTime {
382
/// [`SystemTime`] instance to represent another fixed point in time.
383
///
384
/// [`SystemTime`]: ../../std/time/struct.SystemTime.html
385
+///
386
+/// # Examples
387
388
+/// ```no_run
389
+/// use std::time::{SystemTime, UNIX_EPOCH};
390
391
+/// match SystemTime::now().duration_since(UNIX_EPOCH) {
392
+/// Ok(n) => println!("1970-01-01 00:00:00 UTC was {} seconds ago!", n.as_secs()),
393
+/// Err(_) => panic!("SystemTime before UNIX EPOCH!"),
394
+/// }
395
+/// ```
396
#[stable(feature = "time2", since = "1.8.0")]
397
pub const UNIX_EPOCH: SystemTime = SystemTime(time::UNIX_EPOCH);
398
0 commit comments