Linux RTC
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Mark Salyzyn <salyzyn@android.com>
Cc: linux-kernel@vger.kernel.org,
	Alessandro Zummo <a.zummo@towertech.it>,
	rtc-linux@googlegroups.com
Subject: [rtc-linux] Re: rtc-palmas: correct for bcd year
Date: Fri, 8 Jul 2016 16:10:23 +0200	[thread overview]
Message-ID: <20160708141023.GH22202@piout.net> (raw)
In-Reply-To: <568BEA92.2090701@android.com>

On 05/01/2016 at 08:08:50 -0800, Mark Salyzyn wrote :
> On 01/04/2016 04:00 PM, Alexandre Belloni wrote:
> > I'd say that the proper course of action is to refuse to set dates
> > before 2000 and after 2100. See
> > http://patchwork.ozlabs.org/patch/541037/
> Got it.
> 
> We have an issue though, Android (or rather any embedded) devices must
> continue to function when date is manually set to any value between 1970 and
> 2037. The issue here is a fresh device with a recently charged battery will
> _start_ at 1970 until ntp or cell time/date/locale is set and the device
> must continue to function in this vacuum. A device reboot should not result
> in the other calendar values being reset, should the year be wrong, as this
> will result in a bad user experience.
> 
> We will have to use a different patch on Android than upstream if dates
> before 2000 are deprecated.
> 
> All other factors (rollover, leap) can be corrected by frameworks and
> runtime since the rtc is generally secondary (ie: first rtc driver was in
> 1979, created a daemon to correct the flaws in the hardware clock using a
> cron job)
> 

Well, I was still thinking about that issue but while handling properly
a gap in the RTC continuity is impossible, it is actually easy to handle
an offset in the RTC by using mktime and then offseting the resulting
time_t. Of course you'll then need to handle leap years and the likes
but you said that was not an issue for you.

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

-- 
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.
--- 
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 email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

      reply	other threads:[~2016-07-08 14:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-30 20:51 [rtc-linux] rtc-palmas: correct for bcd year Mark Salyzyn
2016-01-04 16:18 ` [rtc-linux] " Alexandre Belloni
2016-01-04 16:45   ` Mark Salyzyn
2016-01-05  0:00     ` Alexandre Belloni
2016-01-05 16:08       ` Mark Salyzyn
2016-07-08 14:10         ` 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=20160708141023.GH22202@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=salyzyn@android.com \
    /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