commit f23005eba7d323d3f26e90972fc042f4d2002df7 (tree)
parent 2a73700c0fc177fb8781b277a6ba5017dce875b9
Author: ominitay <37453713+ominitay@users.noreply.github.com>
Date: Sat, 8 Jan 2022 21:14:22 +0000
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.
Diffstat:
1 file changed, 7 insertions(+), 20 deletions(-)
diff --git a/lib/std/c/darwin.zig b/lib/std/c/darwin.zig
@@ -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;
}
};