Source
pub fn fromLinux(stx: linux.Statx) Stat {
const atime = stx.atime;
const mtime = stx.mtime;
const ctime = stx.ctime;
return .{
.inode = stx.ino,
.size = stx.size,
.mode = stx.mode,
.kind = switch (stx.mode & linux.S.IFMT) {
linux.S.IFDIR => .directory,
linux.S.IFCHR => .character_device,
linux.S.IFBLK => .block_device,
linux.S.IFREG => .file,
linux.S.IFIFO => .named_pipe,
linux.S.IFLNK => .sym_link,
linux.S.IFSOCK => .unix_domain_socket,
else => .unknown,
},
.atime = @as(i128, atime.sec) * std.time.ns_per_s + atime.nsec,
.mtime = @as(i128, mtime.sec) * std.time.ns_per_s + mtime.nsec,
.ctime = @as(i128, ctime.sec) * std.time.ns_per_s + ctime.nsec,
};
}