# Re: \[PATCH v5\] rtc: Improve performance of rtc\_time64\_to\_tm(). Add tests.

- From: Alexandre Belloni \<alexandre.belloni@bootlin.com\>
- Date: 2021-08-09 22:10:04 
- List: linux-rtc
- Page: https://ratatoskr.run/linux-rtc/2021/08/1472417
- Thread: https://ratatoskr.run/linux-rtc/2021/06/1425308/t.md

```text
On Thu, 24 Jun 2021 21:13:43 +0100, Cassio Neri wrote:
> The current implementation of rtc_time64_to_tm() contains unnecessary
> loops, branches and look-up tables. The new one uses an arithmetic-based
> algorithm appeared in [1] and is approximately 4.3 times faster (YMMV).
> 
> The drawback is that the new code isn't intuitive and contains many 'magic
> numbers' (not unusual for this type of algorithm). However, [1] justifies
> all those numbers and, given this function's history, the code is unlikely
> to need much maintenance, if any at all.
> 
> [...]

Applied, thanks!

[1/1] rtc: Improve performance of rtc_time64_to_tm(). Add tests.
      commit: 1d1bb12a8b1805ddeef9793ebeb920179fb0fa38

Best regards,
-- 
Alexandre Belloni [ref]
```
