From f23005eba7d323d3f26e90972fc042f4d2002df7 Mon Sep 17 00:00:00 2001 From: ominitay <37453713+ominitay@users.noreply.github.com> Date: Sat, 8 Jan 2022 21:14:22 +0000 Subject: [PATCH] std.c.darwin.Stat: use timespec Uses timespec for times in `Stat` instead of two `isize` fields per time. This matches the header file. --- lib/std/c/darwin.zig | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/lib/std/c/darwin.zig b/lib/std/c/darwin.zig index f4ca9cd6dd..3f5b8b340a 100644 --- 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; } };