AK: Add Time.h helper to compute the number of days since epoch

This commit is contained in:
Timothy Flynn 2022-01-05 11:50:15 -05:00 committed by Linus Groh
parent 0c75a14b4f
commit bb9db5937a
Notes: sideshowbarker 2024-07-17 21:34:54 +09:00

View file

@ -61,6 +61,11 @@ inline int years_to_days_since_epoch(int year)
return days;
}
inline int days_since_epoch(int year, int month, int day)
{
return years_to_days_since_epoch(year) + day_of_year(year, month, day);
}
/*
* Represents a time amount in a "safe" way.
* Minimum: 0 seconds, 0 nanoseconds
@ -301,6 +306,7 @@ using AK::day_of_week;
using AK::day_of_year;
using AK::days_in_month;
using AK::days_in_year;
using AK::days_since_epoch;
using AK::is_leap_year;
using AK::Time;
using AK::timespec_add;