From: Eric Wong <e@80x24.org>
To: Riwen Lu <luriwen@kylinos.cn>
Cc: a.zummo@towertech.it, alexandre.belloni@bootlin.com,
linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] rtc: cmos: Evaluate century appropriate
Date: Tue, 11 Jan 2022 18:07:15 +0000 [thread overview]
Message-ID: <20220111180715.GB11432@dcvr> (raw)
In-Reply-To: <20220106084609.1223688-1-luriwen@kylinos.cn>
Riwen Lu <luriwen@kylinos.cn> wrote:
> There's limiting the year to 2069. When setting the rtc year to 2070,
> reading it returns 1970. Evaluate century starting from 19 to count the
> correct year.
>
> $ sudo date -s 20700106
> Mon 06 Jan 2070 12:00:00 AM CST
> $ sudo hwclock -w
> $ sudo hwclock -r
> 1970-01-06 12:00:49.604968+08:00
>
> Fixes: 2a4daadd4d3e5071 ("rtc: cmos: ignore bogus century byte")
>
> Signed-off-by: Riwen Lu <luriwen@kylinos.cn>
Oops, I'm not good at arithmetic :x Thanks for this fix.
Acked-by: Eric Wong <e@80x24.org>
> index dcfaf09946ee..2065842f775d 100644
> --- a/drivers/rtc/rtc-mc146818-lib.c
> +++ b/drivers/rtc/rtc-mc146818-lib.c
> @@ -104,7 +104,7 @@ unsigned int mc146818_get_time(struct rtc_time *time)
> time->tm_year += real_year - 72;
> #endif
>
> - if (century > 20)
> + if (century > 19)
> time->tm_year += (century - 19) * 100;
>
> /*
next prev parent reply other threads:[~2022-01-11 18:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-06 8:46 [PATCH v1] rtc: cmos: Evaluate century appropriate Riwen Lu
2022-01-11 18:07 ` Eric Wong [this message]
2022-01-16 22:58 ` Alexandre Belloni
[not found] <20220106084609.1223688-1-luriwen () kylinos ! cn>
2022-01-07 12:43 ` Mateusz Jończyk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220111180715.GB11432@dcvr \
--to=e@80x24.org \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=luriwen@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.