Zig 0.17.0-dev (Split by item)
This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig library itself.
Zig › std/ › Io/ › Dispatch.zig › timeFromTimeout
timeFromTimeout
Dispatch.timeFromTimeout
fn timeFromTimeout (ev : *Evented , timeout : Io .Timeout ) c .dispatch .time_t
File
Code
fn timeFromTimeout (ev : *Evented , timeout : Io .Timeout ) c .dispatch .time_t {
return timeout : switch (timeout ) {
.none => .FOREVER ,
.duration => |duration | .time (switch (duration .clock ) {
.real => .WALL_NOW ,
else => .NOW ,
}, std .math .lossyCast (i64 , duration .raw .toNanoseconds ())),
.deadline => |deadline | switch (deadline .clock ) {
.real => .walltime (&.{
.sec = @intCast (@divFloor (deadline .raw .toNanoseconds (), std .time .ns_per_s )),
.nsec = @intCast (@mod (deadline .raw .toNanoseconds (), std .time .ns_per_s )),
}, 0 ),
else => continue :timeout .{ .duration = deadline .durationFromNow (ev .io ()) },
},
};
}