mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:37:44 +00:00
AK: Add Time.h helper to compute the number of days since epoch
This commit is contained in:
parent
0c75a14b4f
commit
bb9db5937a
1 changed files with 6 additions and 0 deletions
|
@ -61,6 +61,11 @@ inline int years_to_days_since_epoch(int year)
|
||||||
return days;
|
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.
|
* Represents a time amount in a "safe" way.
|
||||||
* Minimum: 0 seconds, 0 nanoseconds
|
* Minimum: 0 seconds, 0 nanoseconds
|
||||||
|
@ -301,6 +306,7 @@ using AK::day_of_week;
|
||||||
using AK::day_of_year;
|
using AK::day_of_year;
|
||||||
using AK::days_in_month;
|
using AK::days_in_month;
|
||||||
using AK::days_in_year;
|
using AK::days_in_year;
|
||||||
|
using AK::days_since_epoch;
|
||||||
using AK::is_leap_year;
|
using AK::is_leap_year;
|
||||||
using AK::Time;
|
using AK::Time;
|
||||||
using AK::timespec_add;
|
using AK::timespec_add;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue