std.c.Wasi.Stat: use timespec

This commit is contained in:
ominitay 2022-01-08 21:18:42 +00:00
parent 3dd3c5063b
commit d978fdaa67
No known key found for this signature in database
GPG Key ID: DD7CAB34AB04B8E2
2 changed files with 7 additions and 19 deletions

View File

@ -41,32 +41,20 @@ pub const Stat = extern struct {
blksize: i32,
blocks: i64,
atimesec: time_t,
atimensec: isize,
mtimesec: time_t,
mtimensec: isize,
ctimesec: time_t,
ctimensec: isize,
atim: timespec,
mtim: timespec,
ctim: timespec,
pub fn atime(self: @This()) timespec {
return timespec{
.tv_sec = self.atimesec,
.tv_nsec = self.atimensec,
};
return self.atim;
}
pub fn mtime(self: @This()) timespec {
return timespec{
.tv_sec = self.mtimesec,
.tv_nsec = self.mtimensec,
};
return self.mtim;
}
pub fn ctime(self: @This()) timespec {
return timespec{
.tv_sec = self.ctimesec,
.tv_nsec = self.ctimensec,
};
return self.ctim;
}
};

View File

@ -88,7 +88,7 @@ pub const mode_t = u32;
pub const time_t = i64; // match https://github.com/CraneStation/wasi-libc
pub const timespec = struct {
pub const timespec = extern struct {
tv_sec: time_t,
tv_nsec: isize,