File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -132,12 +132,12 @@ pub const Time = extern struct {
132
132
/// Time is to be interpreted as local time
133
133
pub const unspecified_timezone : i16 = 0x7ff ;
134
134
135
- fn daysInYear (year : u16 , maxMonth : u4 ) u32 {
136
- const leapYear : std.time.epoch.YearLeapKind = if (std .time .epoch .isLeapYear (year )) .leap else .not_leap ;
137
- var days : u32 = 0 ;
135
+ fn daysInYear (year : u16 , max_month : u4 ) u9 {
136
+ const leap_year : std.time.epoch.YearLeapKind = if (std .time .epoch .isLeapYear (year )) .leap else .not_leap ;
137
+ var days : u9 = 0 ;
138
138
var month : u4 = 0 ;
139
- while (month < maxMonth ) : (month += 1 ) {
140
- days += std .time .epoch .getDaysInMonth (leapYear , @enumFromInt (month + 1 ));
139
+ while (month < max_month ) : (month += 1 ) {
140
+ days += std .time .epoch .getDaysInMonth (leap_year , @enumFromInt (month + 1 ));
141
141
}
142
142
return days ;
143
143
}
@@ -151,9 +151,9 @@ pub const Time = extern struct {
151
151
}
152
152
153
153
days += daysInYear (self .year , @as (u4 , @intCast (self .month )) - 1 ) + self .day ;
154
- const hours = self .hour + (days * 24 );
155
- const minutes = self .minute + (hours * 60 );
156
- const seconds = self .second + (minutes * std .time .s_per_min );
154
+ const hours : u64 = self .hour + (days * 24 );
155
+ const minutes : u64 = self .minute + (hours * 60 );
156
+ const seconds : u64 = self .second + (minutes * std .time .s_per_min );
157
157
return self .nanosecond + (seconds * std .time .ns_per_s );
158
158
}
159
159
};
You can’t perform that action at this time.
0 commit comments