From 9059f616c7bd0f6dfc24b208187ebc0e8e40ccdf Mon Sep 17 00:00:00 2001 From: Yage Hu Date: Sat, 16 Dec 2023 22:12:04 -0800 Subject: [PATCH] Use nanoseconds in `filestat` This commit fixes the `filestat` type which contains three timestamps. Per [WASI spec], they should be in nanoseconds. This is only a problem for directories. [WASI spec]: https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md#-timestamp-u64 Signed-off-by: Yage Hu --- lib/virtual-fs/src/mem_fs/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/virtual-fs/src/mem_fs/mod.rs b/lib/virtual-fs/src/mem_fs/mod.rs index 8d16dd784eb..77e85d9db26 100644 --- a/lib/virtual-fs/src/mem_fs/mod.rs +++ b/lib/virtual-fs/src/mem_fs/mod.rs @@ -142,7 +142,7 @@ fn time() -> u64 { std::time::SystemTime::now() .duration_since(std::time::SystemTime::UNIX_EPOCH) .unwrap() - .as_secs() + .as_nanos() as u64 } #[cfg(feature = "no-time")]