Function toTimespec [src]
Prototype
pub fn toTimespec(t: Timeout, buf: *std.posix.timespec) ?*std.posix.timespec
Parameters
t: Timeout
buf: *std.posix.timespec
Source
pub fn toTimespec(t: Timeout, buf: *std.posix.timespec) ?*std.posix.timespec {
return switch (t) {
.none => null,
.ms => |ms_u16| {
const ms: isize = ms_u16;
buf.* = .{
.sec = @divTrunc(ms, std.time.ms_per_s),
.nsec = @rem(ms, std.time.ms_per_s) * std.time.ns_per_ms,
};
return buf;
},
};
}