authorgravatar for 37453713+ominitay@users.noreply.github.comominitay <37453713+ominitay@users.noreply.github.com> 2022-01-08 21:14:22+00:00
committergravatar for 37453713+ominitay@users.noreply.github.comominitay <37453713+ominitay@users.noreply.github.com> 2022-02-13 20:40:44+00:00
logf23005eba7d323d3f26e90972fc042f4d2002df7
tree6a9b544caabfeae3c2243155ccea002b8e84503f
parent2a73700c0fc177fb8781b277a6ba5017dce875b9
signature Commit is signed but in an unrecognized format.

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.

1 files changed, 7 insertions(+), 20 deletions(-)

lib/std/c/darwin.zig+7-20
......@@ -372,14 +372,10 @@ pub const Stat = extern struct {
372372 uid: uid_t,
373373 gid: gid_t,
374374 rdev: i32,
375 atimesec: isize,
376 atimensec: isize,
377 mtimesec: isize,
378 mtimensec: isize,
379 ctimesec: isize,
380 ctimensec: isize,
381 birthtimesec: isize,
382 birthtimensec: isize,
375 atimespec: timespec,
376 mtimespec: timespec,
377 ctimespec: timespec,
378 birthtimespec: timespec,
383379 size: off_t,
384380 blocks: i64,
385381 blksize: i32,
......@@ -389,24 +385,15 @@ pub const Stat = extern struct {
389385 qspare: [2]i64,
390386
391387 pub fn atime(self: @This()) timespec {
392 return timespec{
393 .tv_sec = self.atimesec,
394 .tv_nsec = self.atimensec,
395 };
388 return self.atimespec;
396389 }
397390
398391 pub fn mtime(self: @This()) timespec {
399 return timespec{
400 .tv_sec = self.mtimesec,
401 .tv_nsec = self.mtimensec,
402 };
392 return self.mtimespec;
403393 }
404394
405395 pub fn ctime(self: @This()) timespec {
406 return timespec{
407 .tv_sec = self.ctimesec,
408 .tv_nsec = self.ctimensec,
409 };
396 return self.ctimespec;
410397 }
411398};
412399