[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ebff4525-b25d-477b-9d79-d32d2b7829a7@sirena.org.uk>
Date: Fri, 30 Jan 2026 15:11:13 +0000
From: Mark Brown <broonie@...nel.org>
To: Jinjie Ruan <ruanjinjie@...wei.com>
Cc: jstultz@...gle.com, tglx@...nel.org, sboyd@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kunit: time: use is_leap_year() helper
On Fri, Jan 23, 2026 at 04:09:40PM +0800, Jinjie Ruan wrote:
> Use the is_leap_year() helper from rtc.h instead of
> writing it by hand
This patch introduces a regression:
[14:26:27] =============== time_test_cases (1 subtest) ================
[14:26:27] # time64_to_tm_test_date_range: ASSERTION FAILED at kernel/time/time_test.c:73
[14:26:27] Expected month - 1 == result.tm_mon, but
[14:26:27] month - 1 == 2 (0x2)
[14:26:27] result.tm_mon == 1 (0x1)
[14:26:27] -77996/03/01 (59) : -29206923
[14:26:27] # time64_to_tm_test_date_range.speed: slow
[14:26:27] [FAILED] time64_to_tm_test_date_range
[14:26:27] # module: time_test
[14:26:27] ================= [FAILED] time_test_cases =================
[14:26:27] ============================================================
[14:26:27] Testing complete. Ran 1 tests: failed: 1
> -/*
> - * Traditional implementation of leap year evaluation.
> - */
> -static bool is_leap(long year)
> -{
> - return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
> -}
gets replaced by is_leap_year() which is:
static inline bool is_leap_year(unsigned int year)
{
return (!(year % 4) && (year % 100)) || !(year % 400);
}
which looks like it ought to work out the same from a quick look
although it is written less clearly. I'll look properly later when I've
got through the rest of the pile of regressions.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists