make get_filestat work

up to 16 tests passing!
This commit is contained in:
Pat Hickey
2020-12-16 17:54:17 -08:00
parent 23b5689a5f
commit df0218c086
2 changed files with 44 additions and 13 deletions

View File

@@ -1024,6 +1024,27 @@ impl From<&OFlags> for types::Oflags {
}
impl From<Filestat> for types::Filestat {
fn from(stat: Filestat) -> types::Filestat {
todo!()
types::Filestat {
dev: stat.device_id,
ino: stat.inode,
filetype: types::Filetype::from(&stat.filetype),
nlink: stat.nlink,
size: stat.size,
atim: stat
.atim
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_nanos() as u64,
mtim: stat
.mtim
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_nanos() as u64,
ctim: stat
.ctim
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_nanos() as u64,
}
}
}