std.c.darwin.Stat: use timespec

Uses timespec for times in `Stat` instead of two `isize` fields per time. This matches the <sys/stat.h> header file.
This commit is contained in:
ominitay 2022-01-08 21:14:22 +00:00
parent 2a73700c0f
commit f23005eba7
No known key found for this signature in database
GPG Key ID: DD7CAB34AB04B8E2

View File

@ -372,14 +372,10 @@ pub const Stat = extern struct {
uid: uid_t,
gid: gid_t,
rdev: i32,
atimesec: isize,
atimensec: isize,
mtimesec: isize,
mtimensec: isize,
ctimesec: isize,
ctimensec: isize,
birthtimesec: isize,
birthtimensec: isize,
atimespec: timespec,
mtimespec: timespec,
ctimespec: timespec,
birthtimespec: timespec,
size: off_t,
blocks: i64,
blksize: i32,
@ -389,24 +385,15 @@ pub const Stat = extern struct {
qspare: [2]i64,
pub fn atime(self: @This()) timespec {
return timespec{
.tv_sec = self.atimesec,
.tv_nsec = self.atimensec,
};
return self.atimespec;
}
pub fn mtime(self: @This()) timespec {
return timespec{
.tv_sec = self.mtimesec,
.tv_nsec = self.mtimensec,
};
return self.mtimespec;
}
pub fn ctime(self: @This()) timespec {
return timespec{
.tv_sec = self.ctimesec,
.tv_nsec = self.ctimensec,
};
return self.ctimespec;
}
};