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:
parent
d0ef740266
commit
d1681bbde5
7 changed files with 183 additions and 8 deletions
|
@ -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};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue