From bb9db5937a189699490adb3d5ae126396e5d4741 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 5 Jan 2022 11:50:15 -0500 Subject: [PATCH] AK: Add Time.h helper to compute the number of days since epoch --- AK/Time.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AK/Time.h b/AK/Time.h index 64f13230ed..7365240462 100644 --- a/AK/Time.h +++ b/AK/Time.h @@ -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;