Skip to content

Commit

Permalink
fix file creation ts for WASI Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark McCaskey committed May 20, 2019
1 parent d7d17bd commit f2001fe
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions lib/wasi/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
}
Expand All @@ -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()
})
}
Expand Down
Binary file modified lib/wasi/wasitests/file_metadata
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/wasi/wasitests/file_metadata.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
is dir: false
filetype: false true false
file info: 491
file info: 456
2 changes: 1 addition & 1 deletion lib/wasi/wasitests/file_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Binary file modified lib/wasi/wasitests/file_metadata.wasm
Binary file not shown.

0 comments on commit f2001fe

Please sign in to comment.