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. Private Function
fnisProblematicTimestamp(man: *Manifest, timestamp: Io.Timestamp) error{Canceled}!bool {
constio = man.cache.io;
// If the file_time is prior to the most recent problematic timestamp// then we don't need to access the filesystem.if (timestamp.nanoseconds < man.recent_problematic_timestamp.nanoseconds)
returnfalse;
// Next we will check the globally shared Cache timestamp, which is accessed// from multiple threads.tryman.cache.mutex.lock(io);
deferman.cache.mutex.unlock(io);
// Save the global one to our local one to avoid locking next time.man.recent_problematic_timestamp = man.cache.recent_problematic_timestamp;
if (timestamp.nanoseconds < man.recent_problematic_timestamp.nanoseconds)
returnfalse;
// This flag prevents multiple filesystem writes for the same hit() call.if (man.want_refresh_timestamp) {
man.want_refresh_timestamp = false;
varfile = man.cache.manifest_dir.createFile(io, "timestamp", .{
.read = true,
.truncate = true,
}) catch |err| switch (err) {
error.Canceled => |e| returne,
else => returntrue,
};
deferfile.close(io);
// Save locally and also save globally (we still hold the global lock).conststat = file.stat(io) catch |err| switch (err) {
error.Canceled => |e| returne,
else => returntrue,
};
man.recent_problematic_timestamp = stat.mtime;
man.cache.recent_problematic_timestamp = man.recent_problematic_timestamp;
}
returntimestamp.nanoseconds >= man.recent_problematic_timestamp.nanoseconds;
}