Linux RTC
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	rtc-linux@googlegroups.com, kernel@pengutronix.de
Subject: [rtc-linux] Re: [PATCH] rtc: pcf8523: refuse to write dates later than 2099
Date: Wed, 25 Nov 2015 00:35:17 +0100	[thread overview]
Message-ID: <20151124233517.GI3950@piout.net> (raw)
In-Reply-To: <1446827876-31613-1-git-send-email-u.kleine-koenig@pengutronix.de>

Hi,

On 06/11/2015 at 17:37:56 +0100, Uwe Kleine-K=C3=B6nig wrote :
> When the chip increments the YEAR register and it already holds
> bin2bcd(99) it reads as 0 afterwards. With this behaviour the last valid
> day (without trickery) that has a representation is 2099-12-31 23:59:59.
> So refuse to write later dates.
>=20
> Signed-off-by: Uwe Kleine-K=C3=B6nig <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
>=20
> When setting the YEAR register to bin2bcd(100) =3D=3D 0xa0 it increments
> just fine up to bin2bcd(159) =3D=3D 0xf9 but these values are forbidden i=
n
> the manual. But this doesn't help to expand (or shift) the range of
> supported dates.
>=20
> An alternative to this patch would be to save tm_year % 100 because
> that's what happens when waiting long enough anyhow. Would that be
> better? Do we already care at all for year-2100-problems?
>=20

There is no way to tell whether the date is fine after February
2100 so I will take the patch as is.

--=20
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

--=20
--=20
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---=20
You received this message because you are subscribed to the Google Groups "=
rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

      reply	other threads:[~2015-11-24 23:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 16:37 [rtc-linux] [PATCH] rtc: pcf8523: refuse to write dates later than 2099 Uwe Kleine-König
2015-11-24 23:35 ` Alexandre Belloni [this message]

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=20151124233517.GI3950@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=a.zummo@towertech.it \
    --cc=kernel@pengutronix.de \
    --cc=rtc-linux@googlegroups.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox