mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:07:46 +00:00
AK+LibC+LibCore: Have fewer implementations of day_of_week
The implementation in LibC did a timestamp->day-of-week conversion which looks like a valuable thing to have. But we only need it in time_to_tm, where we already computed year/month/day -- so let's consolidate on the day_of_week function in DateTime (which is getting extracted to AK).
This commit is contained in:
parent
b9cbb4fd00
commit
1ab8939077
4 changed files with 20 additions and 12 deletions
|
@ -28,6 +28,12 @@
|
|||
|
||||
namespace AK {
|
||||
|
||||
// Month and day start at 1. Month must be >= 1 and <= 12.
|
||||
// The return value is 0-indexed, that is 0 is Sunday, 1 is Monday, etc.
|
||||
// Day may be negative or larger than the number of days
|
||||
// in the given month.
|
||||
unsigned day_of_week(int year, unsigned month, int day);
|
||||
|
||||
// Month and day start at 1. Month must be >= 1 and <= 12.
|
||||
// The return value is 0-indexed, that is Jan 1 is day 0.
|
||||
// Day may be negative or larger than the number of days
|
||||
|
@ -176,6 +182,7 @@ inline bool operator!=(const TimespecType& a, const TimespecType& b)
|
|||
|
||||
}
|
||||
|
||||
using AK::day_of_week;
|
||||
using AK::day_of_year;
|
||||
using AK::days_in_month;
|
||||
using AK::days_in_year;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue