Commit 1640c357f4

xackus <14938807+xackus@users.noreply.github.com>
2021-01-05 12:49:56
freebsd, netbsd, dragonfly: add struct timeval
1 parent 3e8aaee
Changed files (3)
lib/std/os/bits/dragonfly.zig
@@ -20,6 +20,7 @@ pub const off_t = c_long;
 pub const mode_t = c_uint;
 pub const uid_t = u32;
 pub const gid_t = u32;
+pub const suseconds_t = c_long;
 
 pub const ENOTSUP = EOPNOTSUPP;
 pub const EWOULDBLOCK = EAGAIN;
@@ -190,6 +191,13 @@ pub const timespec = extern struct {
     tv_nsec: c_long,
 };
 
+pub const timeval = extern struct {
+    /// seconds
+    tv_sec: time_t,
+    /// microseconds
+    tv_usec: suseconds_t,
+};
+
 pub const CTL_UNSPEC = 0;
 pub const CTL_KERN = 1;
 pub const CTL_VM = 2;
lib/std/os/bits/freebsd.zig
@@ -26,6 +26,7 @@ pub const time_t = i64;
 pub const clock_t = isize;
 
 pub const socklen_t = u32;
+pub const suseconds_t = c_long;
 
 /// Renamed from `kevent` to `Kevent` to avoid conflict with function name.
 pub const Kevent = extern struct {
@@ -169,6 +170,13 @@ pub const timespec = extern struct {
     tv_nsec: isize,
 };
 
+pub const timeval = extern struct {
+    /// seconds
+    tv_sec: time_t,
+    /// microseconds
+    tv_usec: suseconds_t,
+};
+
 pub const dirent = extern struct {
     d_fileno: usize,
     d_off: i64,
lib/std/os/bits/netbsd.zig
@@ -22,6 +22,7 @@ pub const socklen_t = u32;
 pub const time_t = i64;
 pub const uid_t = u32;
 pub const lwpid_t = i32;
+pub const suseconds_t = c_int;
 
 /// Renamed from `kevent` to `Kevent` to avoid conflict with function name.
 pub const Kevent = extern struct {
@@ -190,6 +191,13 @@ pub const timespec = extern struct {
     tv_nsec: isize,
 };
 
+pub const timeval = extern struct {
+    /// seconds
+    tv_sec: time_t,
+    /// microseconds
+    tv_usec: suseconds_t,
+};
+
 pub const MAXNAMLEN = 511;
 
 pub const dirent = extern struct {