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
signaturelock-open 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 {...@@ -372,14 +372,10 @@ pub const Stat = extern struct {
372 uid: uid_t,372 uid: uid_t,
373 gid: gid_t,373 gid: gid_t,
374 rdev: i32,374 rdev: i32,
375 atimesec: isize,375 atimespec: timespec,
376 atimensec: isize,376 mtimespec: timespec,
377 mtimesec: isize,377 ctimespec: timespec,
378 mtimensec: isize,378 birthtimespec: timespec,
379 ctimesec: isize,
380 ctimensec: isize,
381 birthtimesec: isize,
382 birthtimensec: isize,
383 size: off_t,379 size: off_t,
384 blocks: i64,380 blocks: i64,
385 blksize: i32,381 blksize: i32,
...@@ -389,24 +385,15 @@ pub const Stat = extern struct {...@@ -389,24 +385,15 @@ pub const Stat = extern struct {
389 qspare: [2]i64,385 qspare: [2]i64,
390386
391 pub fn atime(self: @This()) timespec {387 pub fn atime(self: @This()) timespec {
392 return timespec{388 return self.atimespec;
393 .tv_sec = self.atimesec,
394 .tv_nsec = self.atimensec,
395 };
396 }389 }
397390
398 pub fn mtime(self: @This()) timespec {391 pub fn mtime(self: @This()) timespec {
399 return timespec{392 return self.mtimespec;
400 .tv_sec = self.mtimesec,
401 .tv_nsec = self.mtimensec,
402 };
403 }393 }
404394
405 pub fn ctime(self: @This()) timespec {395 pub fn ctime(self: @This()) timespec {
406 return timespec{396 return self.ctimespec;
407 .tv_sec = self.ctimesec,
408 .tv_nsec = self.ctimensec,
409 };
410 }397 }
411};398};
412399