Re: [GIT PULL] RTC changes for 5.15

From: Linus Torvalds
Date: Sat Sep 11 2021 - 13:05:25 EST


On Sat, Sep 11, 2021 at 8:59 AM Alexandre Belloni
<alexandre.belloni@xxxxxxxxxxx> wrote:
>
> The broken down time conversion is similar to what is done
> in the time subsystem since v5.14.

By "similar" you mean "identical", no?

Why is the rtc subsystem not just using the generic time64_to_tm()?

Yes, yes, I realize that due to historical mistakes, there's a
duplicate 'struct rtc_time' struct, but it turns out that that is
_identical_ to 'struct tm' except it also has a 'int tm_isdst' at the
end.

So you could literally make a union of the two, pass the 'struct tm'
part down to the generic code, and just do

rtc_tm->tm_isdst = 0;

at the end.

Rather than have a duplicate copy of that admittedly clever Neri and
Schneider algorithm.

Hmm?

Linus