From: "tip-bot2 for Jinjie Ruan" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Jinjie Ruan <ruanjinjie@huawei.com>,
Thomas Gleixner <tglx@kernel.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/core] time/kunit: Use is_leap_year() helper
Date: Mon, 26 Jan 2026 15:22:56 -0000 [thread overview]
Message-ID: <176944097652.510.12277737328875446092.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260123080940.335474-1-ruanjinjie@huawei.com>
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 3d431a106947a4a18ff5d3ba270a25df6a136e2f
Gitweb: https://git.kernel.org/tip/3d431a106947a4a18ff5d3ba270a25df6a136e2f
Author: Jinjie Ruan <ruanjinjie@huawei.com>
AuthorDate: Fri, 23 Jan 2026 16:09:40 +08:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Mon, 26 Jan 2026 16:05:09 +01:00
time/kunit: Use is_leap_year() helper
Use the is_leap_year() helper from rtc.h instead of open coding it.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260123080940.335474-1-ruanjinjie@huawei.com
---
kernel/time/time_test.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/kernel/time/time_test.c b/kernel/time/time_test.c
index 2889763..7c2fb5f 100644
--- a/kernel/time/time_test.c
+++ b/kernel/time/time_test.c
@@ -2,14 +2,7 @@
#include <kunit/test.h>
#include <linux/time.h>
-
-/*
- * Traditional implementation of leap year evaluation.
- */
-static bool is_leap(long year)
-{
- return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
-}
+#include <linux/rtc.h>
/*
* Gets the last day of a month.
@@ -17,7 +10,7 @@ static bool is_leap(long year)
static int last_day_of_month(long year, int month)
{
if (month == 2)
- return 28 + is_leap(year);
+ return 28 + is_leap_year(year);
if (month == 4 || month == 6 || month == 9 || month == 11)
return 30;
return 31;
next prev parent reply other threads:[~2026-01-26 15:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-23 8:09 [PATCH] kunit: time: use " Jinjie Ruan
2026-01-26 15:22 ` tip-bot2 for Jinjie Ruan [this message]
2026-01-30 15:11 ` Mark Brown
2026-01-30 19:39 ` Mark Brown
2026-01-30 21:13 ` Thomas Gleixner
2026-01-31 13:31 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=176944097652.510.12277737328875446092.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=ruanjinjie@huawei.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®