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 › time › epoch › testEpoch Private Function testEpoch Doc Source Private Function std.time.epoch.testEpoch
fn testEpoch (secs : u64 , expected_year_day : YearAndDay , expected_month_day : MonthAndDay , expected_day_seconds : struct Params secs : u64 expected_year_day : YearAndDay expected_month_day : MonthAndDay expected_day_seconds : struct { /// 0 to 23 hours_into_day : u5 , /// 0 to 59 minutes_into_hour : u6 , /// 0 to 59 seconds_into_minute : u6 , } File time/epoch.zig: 185
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202 fn testEpoch (secs : u64 , expected_year_day : YearAndDay , expected_month_day : MonthAndDay , expected_day_seconds : struct {
/// 0 to 23
hours_into_day : u5 ,
/// 0 to 59
minutes_into_hour : u6 ,
/// 0 to 59
seconds_into_minute : u6 ,
}) !void {
const epoch_seconds = EpochSeconds { .secs = secs };
const epoch_day = epoch_seconds .getEpochDay ();
const day_seconds = epoch_seconds .getDaySeconds ();
const year_day = epoch_day .calculateYearDay ();
try testing .expectEqual (expected_year_day , year_day );
try testing .expectEqual (expected_month_day , year_day .calculateMonthDay ());
try testing .expectEqual (expected_day_seconds .hours_into_day , day_seconds .getHoursIntoDay ());
try testing .expectEqual (expected_day_seconds .minutes_into_hour , day_seconds .getMinutesIntoHour ());
try testing .expectEqual (expected_day_seconds .seconds_into_minute , day_seconds .getSecondsIntoMinute ());
}