1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:27:45 +00:00

AK+LibC+LibCore: Have fewer implementations of days_in_month

This commit is contained in:
Nico Weber 2020-08-25 20:11:12 -04:00 committed by Andreas Kling
parent dcb81fc199
commit a7a18b478e
4 changed files with 20 additions and 16 deletions

View file

@ -35,6 +35,9 @@ namespace AK {
// can be negative.
int day_of_year(int year, unsigned month, int day);
// Month starts at 1. Month must be >= 1 and <= 12.
int days_in_month(int year, unsigned month);
inline bool is_leap_year(int year)
{
return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
@ -169,6 +172,7 @@ inline bool operator!=(const TimespecType& a, const TimespecType& b)
}
using AK::day_of_year;
using AK::days_in_month;
using AK::is_leap_year;
using AK::timespec_add;
using AK::timespec_add_timeval;