summaryrefslogtreecommitdiff
path: root/AK/Time.h
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2020-08-25 16:38:24 -0400
committerAndreas Kling <kling@serenityos.org>2020-08-26 08:52:07 +0200
commit84ed2579594fdadef29ba145d8a7948ffe26200b (patch)
tree4a79cc738e8392253977fa1237e3f88aecbfe257 /AK/Time.h
parent394e4c04cd5dfdca56f67e6384288a209bdbf6dc (diff)
downloadserenity-84ed2579594fdadef29ba145d8a7948ffe26200b.zip
AK+LibC+LibCore+Kernel: Have fewer implementations of is_leap_year
Diffstat (limited to 'AK/Time.h')
-rw-r--r--AK/Time.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/AK/Time.h b/AK/Time.h
index dd3e48c770..a5209908a9 100644
--- a/AK/Time.h
+++ b/AK/Time.h
@@ -28,6 +28,11 @@
namespace AK {
+inline bool is_leap_year(int year)
+{
+ return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
+}
+
template<typename TimevalType>
inline void timeval_sub(const TimevalType& a, const TimevalType& b, TimevalType& result)
{
@@ -146,6 +151,7 @@ inline bool operator!=(const TimespecType& a, const TimespecType& b)
}
+using AK::is_leap_year;
using AK::timespec_add;
using AK::timespec_add_timeval;
using AK::timespec_sub;