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/ › Threaded.zig › fallbackSeedPosix
fallbackSeedPosix
Threaded.fallbackSeedPosix
fn fallbackSeedPosix (seed : *[Csprng .seed_len ]u8 ) void
File
Code
fn fallbackSeedPosix (seed : *[Csprng .seed_len ]u8 ) void {
std .mem .writeInt (posix .pid_t , seed [0 ..@sizeOf (posix .pid_t )], posix .system .getpid (), .native );
const i_1 = @sizeOf (posix .pid_t );
var ts : posix .timespec = undefined ;
const Sec = @TypeOf (ts .sec );
const Nsec = @TypeOf (ts .nsec );
const i_2 = i_1 + @sizeOf (Sec );
switch (posix .errno (posix .system .clock_gettime (.REALTIME , &ts ))) {
.SUCCESS => {
std .mem .writeInt (Sec , seed [i_1 ..][0 ..@sizeOf (Sec )], ts .sec , .native );
std .mem .writeInt (Nsec , seed [i_2 ..][0 ..@sizeOf (Nsec )], ts .nsec , .native );
},
else => {},
}
}