lkml.org 
[lkml]   [2018]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] m68k: Fix off-by-one calendar month
On Mon, Apr 23, 2018 at 3:02 AM, Finn Thain <fthain@telegraphics.com.au> wrote:

> diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
> index 97dd4e26f234..6b4389a6e8ea 100644
> --- 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;
> - ts->tv_sec = mktime(time.tm_year, time.tm_mon, time.tm_mday,
> - time.tm_hour, time.tm_min, time.tm_sec);
> - }
> + ts->tv_sec = mktime(time.tm_year + 1900, time.tm_mon + 1, time.tm_mday,
> + time.tm_hour, time.tm_min, time.tm_sec);
> }

This clashes with a patch I had planned to submit today, but otherwise
looks correct and. I'll respin my patch on top of yours. Since I've taken
a good look at your changes in the meantime

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

Arnd

\
 
 \ /
  Last update: 2018-04-23 10:49    [W:0.058 / U:0.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site