Codechange: use Date/Year constructor explicitly
This commit is contained in:
@@ -77,7 +77,7 @@ public:
|
||||
static constexpr Year DateToYear(Date date)
|
||||
{
|
||||
/* Hardcode the number of days in a year because we can't access CalendarTime from here. */
|
||||
return date.base() / 366;
|
||||
return Year{date.base() / 366};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,10 +88,10 @@ public:
|
||||
static constexpr Date DateAtStartOfYear(Year year)
|
||||
{
|
||||
int32_t year_as_int = year.base();
|
||||
uint number_of_leap_years = (year == 0) ? 0 : ((year_as_int - 1) / 4 - (year_as_int - 1) / 100 + (year_as_int - 1) / 400 + 1);
|
||||
int32_t number_of_leap_years = (year == 0) ? 0 : ((year_as_int - 1) / 4 - (year_as_int - 1) / 100 + (year_as_int - 1) / 400 + 1);
|
||||
|
||||
/* Hardcode the number of days in a year because we can't access CalendarTime from here. */
|
||||
return (365 * year_as_int) + number_of_leap_years;
|
||||
return Date{(365 * year_as_int) + number_of_leap_years};
|
||||
}
|
||||
|
||||
enum Trigger {
|
||||
|
||||
Reference in New Issue
Block a user