| ... | @@ -132,12 +132,12 @@ pub const Time = extern struct { | ... | @@ -132,12 +132,12 @@ pub const Time = extern struct { |
| 132 | /// Time is to be interpreted as local time | 132 | /// Time is to be interpreted as local time |
| 133 | pub const unspecified_timezone: i16 = 0x7ff; | 133 | pub const unspecified_timezone: i16 = 0x7ff; |
| 134 | | 134 | |
| 135 | fn daysInYear(year: u16, maxMonth: u4) u32 { | 135 | fn daysInYear(year: u16, max_month: u4) u9 { |
| 136 | const leapYear: std.time.epoch.YearLeapKind = if (std.time.epoch.isLeapYear(year)) .leap else .not_leap; | 136 | const leap_year: std.time.epoch.YearLeapKind = if (std.time.epoch.isLeapYear(year)) .leap else .not_leap; |
| 137 | var days: u32 = 0; | 137 | var days: u9 = 0; |
| 138 | var month: u4 = 0; | 138 | var month: u4 = 0; |
| 139 | while (month < maxMonth) : (month += 1) { | 139 | while (month < max_month) : (month += 1) { |
| 140 | days += std.time.epoch.getDaysInMonth(leapYear, @enumFromInt(month + 1)); | 140 | days += std.time.epoch.getDaysInMonth(leap_year, @enumFromInt(month + 1)); |
| 141 | } | 141 | } |
| 142 | return days; | 142 | return days; |
| 143 | } | 143 | } |
| ... | @@ -151,9 +151,9 @@ pub const Time = extern struct { | ... | @@ -151,9 +151,9 @@ pub const Time = extern struct { |
| 151 | } | 151 | } |
| 152 | | 152 | |
| 153 | days += daysInYear(self.year, @as(u4, @intCast(self.month)) - 1) + self.day; | 153 | days += daysInYear(self.year, @as(u4, @intCast(self.month)) - 1) + self.day; |
| 154 | const hours = self.hour + (days * 24); | 154 | const hours: u64 = self.hour + (days * 24); |
| 155 | const minutes = self.minute + (hours * 60); | 155 | const minutes: u64 = self.minute + (hours * 60); |
| 156 | const seconds = self.second + (minutes * std.time.s_per_min); | 156 | const seconds: u64 = self.second + (minutes * std.time.s_per_min); |
| 157 | return self.nanosecond + (seconds * std.time.ns_per_s); | 157 | return self.nanosecond + (seconds * std.time.ns_per_s); |
| 158 | } | 158 | } |
| 159 | }; | 159 | }; |