File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -259,6 +259,29 @@ impl fmt::Debug for Instant {
259
259
}
260
260
261
261
impl SystemTime {
262
+ /// An anchor in time which can be used to create new `SystemTime` instances or
263
+ /// learn about where in time a `SystemTime` lies.
264
+ ///
265
+ /// This constant is defined to be "1970-01-01 00:00:00 UTC" on all systems with
266
+ /// respect to the system clock. Using `duration_since` on an existing
267
+ /// `SystemTime` instance can tell how far away from this point in time a
268
+ /// measurement lies, and using `UNIX_EPOCH + duration` can be used to create a
269
+ /// `SystemTime` instance to represent another fixed point in time.
270
+ ///
271
+ /// # Examples
272
+ ///
273
+ /// ```no_run
274
+ /// #![feature(assoc_unix_epoch)]
275
+ /// use std::time::SystemTime;
276
+ ///
277
+ /// match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) {
278
+ /// Ok(n) => println!("1970-01-01 00:00:00 UTC was {} seconds ago!", n.as_secs()),
279
+ /// Err(_) => panic!("SystemTime before UNIX EPOCH!"),
280
+ /// }
281
+ /// ```
282
+ #[ unstable( feature = "assoc_unix_epoch" , issue = "49502" ) ]
283
+ pub const UNIX_EPOCH : SystemTime = UNIX_EPOCH ;
284
+
262
285
/// Returns the system time corresponding to "now".
263
286
///
264
287
/// # Examples
You can’t perform that action at this time.
0 commit comments