Messages in this thread | | | From | Arnd Bergmann <> | Date | Tue, 24 Apr 2018 14:54:15 +0200 | Subject | Re: [PATCH] m68k: Fix off-by-one calendar month |
| |
On Tue, Apr 24, 2018 at 12:37 PM, Alexandre Belloni <alexandre.belloni@bootlin.com> wrote: > On 24/04/2018 12:06:30+0200, Geert Uytterhoeven wrote: >> >> On Mon, Apr 23, 2018 at 3:02 AM, Finn Thain <fthain@telegraphics.com.au> wrote: >> <snip> >> >> > --- a/arch/m68k/kernel/time.c >> > +++ b/arch/m68k/kernel/time.c >> > @@ -74,17 +74,17 @@ static irqreturn_t timer_interrupt(int irq, void *dummy) >> > void read_persistent_clock(struct timespec *ts) >> > { >> > struct rtc_time time; >> > + >> > ts->tv_sec = 0; >> > ts->tv_nsec = 0; >> > >> > - if (mach_hwclk) { >> > - mach_hwclk(0, &time); >> > + if (!mach_hwclk) >> > + return; >> > + >> > + mach_hwclk(0, &time); >> > >> > - if ((time.tm_year += 1900) < 1970) >> > - time.tm_year += 100; > > Note that this change may break existing users.
I had the same thought but then realized that the +=100 logic was simply moved into the individual drivers, so the behavior should not change here.
> I'm perfectly fine with > it as doing this is generally wrong anyway and this is something I'd > like to see eliminated.
I think most of the m68k RTC hardware uses two-digit BCD year numbers, so we can't just remove it without implementing something else to lift the RTC into the current century.
Arnd
| |