mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
AK: Add Time.h helper to compute the number of days since epoch
This commit is contained in:
parent
0c75a14b4f
commit
bb9db5937a
Notes:
sideshowbarker
2024-07-17 21:34:54 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/bb9db5937a1 Pull-request: https://github.com/SerenityOS/serenity/pull/11644 Reviewed-by: https://github.com/Lubrsi Reviewed-by: https://github.com/linusg ✅
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue