rtc: Optimize calculations in rtc_time64_to_tm()
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>
Fri, 13 Jun 2025 14:24:05 +0000 (16:24 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 23 Jul 2025 21:48:06 +0000 (23:48 +0200)
commitae48d3542783cdb826774a751084aa1c536029d5
tree9eec2d3f7349bf6891275b02207bb42b029790cd
parentdb22fd8880a2cb58d8684ba4345b4a8c152b8a4f
rtc: Optimize calculations in rtc_time64_to_tm()

Recently (in commit 7df4cfef8b35 ("rtc: Make rtc_time64_to_tm() support
dates before 1970")) the function rtc_time64_to_tm() was repaired for
times before 1970. This introduced two if blocks. Cassio Neri pointed
out that to be not neccessary and suggested an adaption that allows to
drop the two branch points again.

This is implemented here.

Also adapt the reference to the theoretical paper to link to the final
published article instead of the preprint on Cassio's request.

Suggested-by: Cassio Neri <cassio.neri@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/20250613142405.253420-2-u.kleine-koenig@baylibre.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/lib.c