Function toEpoch [src]
Prototype
pub fn toEpoch(self: std.os.uefi.Time) u64
Parameters
self: std.os.uefi.Time
Source
pub fn toEpoch(self: std.os.uefi.Time) u64 {
var year: u16 = 0;
var days: u32 = 0;
while (year < (self.year - 1971)) : (year += 1) {
days += daysInYear(year + 1970, 12);
}
days += daysInYear(self.year, @as(u4, @intCast(self.month)) - 1) + self.day;
const hours: u64 = self.hour + (days * 24);
const minutes: u64 = self.minute + (hours * 60);
const seconds: u64 = self.second + (minutes * std.time.s_per_min);
return self.nanosecond + (seconds * std.time.ns_per_s);
}