fix file creation ts for WASI Linux

This commit is contained in:
Mark McCaskey 2019-05-20 15:02:22 -07:00
parent d7d17bd647
commit f2001fea50
5 changed files with 10 additions and 10 deletions

View File

@ -488,10 +488,10 @@ pub fn get_stat_for_kind(kind: &Kind) -> Option<__wasi_filestat_t> {
.as_nanos() as u64,
st_ctim: md
.created()
.ok()?
.duration_since(SystemTime::UNIX_EPOCH)
.ok()?
.as_nanos() as u64,
.ok()
.and_then(|ct| ct.duration_since(SystemTime::UNIX_EPOCH).ok())
.map(|ct| ct.as_nanos() as u64)
.unwrap_or(0),
..__wasi_filestat_t::default()
})
}
@ -515,10 +515,10 @@ pub fn get_stat_for_kind(kind: &Kind) -> Option<__wasi_filestat_t> {
.as_nanos() as u64,
st_ctim: md
.created()
.ok()?
.duration_since(SystemTime::UNIX_EPOCH)
.ok()?
.as_nanos() as u64,
.ok()
.and_then(|ct| ct.duration_since(SystemTime::UNIX_EPOCH).ok())
.map(|ct| ct.as_nanos() as u64)
.unwrap_or(0),
..__wasi_filestat_t::default()
})
}

Binary file not shown.

View File

@ -1,3 +1,3 @@
is dir: false
filetype: false true false
file info: 491
file info: 456

View File

@ -13,5 +13,5 @@ fn main() {
filetype.is_file(),
filetype.is_symlink()
);
println!("file info: {} {} {}", md.len(), md.modified(), md.created());
println!("file info: {}", md.len());
}