std: Expose SystemTime accessors on fs::Metadata
These accessors are used to get at the last modification, last access, and creation time of the underlying file. Currently not all platforms provide the creation time, so that currently returns `Option`.
This commit is contained in:
@@ -16,6 +16,7 @@ use error::Error;
|
||||
use fmt;
|
||||
use ops::{Add, Sub};
|
||||
use sys::time;
|
||||
use sys_common::FromInner;
|
||||
|
||||
#[stable(feature = "time", since = "1.3.0")]
|
||||
pub use self::duration::Duration;
|
||||
@@ -227,6 +228,12 @@ impl fmt::Display for SystemTimeError {
|
||||
}
|
||||
}
|
||||
|
||||
impl FromInner<time::SystemTime> for SystemTime {
|
||||
fn from_inner(time: time::SystemTime) -> SystemTime {
|
||||
SystemTime(time)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Instant, SystemTime, Duration, UNIX_EPOCH};
|
||||
|
||||
Reference in New Issue
Block a user