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 standard library.
std › Io › Dispatch › timeFromTimeout Private Function timeFromTimeout Doc Source Private Function std.Io.Dispatch.timeFromTimeout
fn timeFromTimeout (ev : *Evented , timeout : Io .Timeout ) c .dispatch .time_t Params File Io/Dispatch.zig: 4732
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747 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 ()) },
},
};
}