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
|
@ -146,6 +146,12 @@ mod inner {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<libc::timeval> for SystemTime {
|
||||
fn from(t: libc::timeval) -> SystemTime {
|
||||
SystemTime { t: t }
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for SystemTime {
|
||||
fn eq(&self, other: &SystemTime) -> bool {
|
||||
self.t.tv_sec == other.t.tv_sec && self.t.tv_usec == other.t.tv_usec
|
||||
|
@ -282,6 +288,12 @@ mod inner {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<libc::timespec> for SystemTime {
|
||||
fn from(t: libc::timespec) -> SystemTime {
|
||||
SystemTime { t: Timespec { t: t } }
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for SystemTime {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.debug_struct("SystemTime")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue