From 31c715158034f701d5da64f2cb8894c03627ec86 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Dec 2021 19:44:28 +0100 Subject: [PATCH] time/Calendar: add DaysInYear() --- src/time/Calendar.hxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/time/Calendar.hxx b/src/time/Calendar.hxx index c8a0983f1..d9b9c9e40 100644 --- a/src/time/Calendar.hxx +++ b/src/time/Calendar.hxx @@ -51,3 +51,9 @@ DaysInMonth(unsigned month, unsigned year) noexcept else return DaysInFebruary(year); } + +constexpr unsigned +DaysInYear(unsigned year) noexcept +{ + return IsLeapYear(year) ? 366 : 365; +}