mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:47:46 +00:00
AK+LibC+Kernel: Have fewer implementations of year_to_days_in_epoch
I believe the implementation in RTC.cpp had an off-by-one in the year passed to is_leap_year(). If that's true, then this fixes that too.
This commit is contained in:
parent
84ed257959
commit
9b17082899
3 changed files with 13 additions and 18 deletions
|
@ -116,11 +116,7 @@ static time_t tm_to_time(struct tm* tm, long timezone_adjust_seconds)
|
|||
tm->tm_mon += 12;
|
||||
}
|
||||
|
||||
int days = 0;
|
||||
for (int year = 70; year < tm->tm_year; ++year)
|
||||
days += 365 + is_leap_year(1900 + year);
|
||||
for (int year = tm->tm_year; year < 70; ++year)
|
||||
days -= 365 + is_leap_year(1900 + year);
|
||||
int days = years_to_days_since_epoch(1900 + tm->tm_year);
|
||||
|
||||
tm->tm_yday = tm->tm_mday - 1;
|
||||
for (int month = 0; month < tm->tm_mon; ++month)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue