From: Ralf Baechle <ralf@linux-mips.org>
To: Attila Kinali <attila@kinali.ch>
Cc: linux-mips@linux-mips.org
Subject: Re: Power loss and system time when not having a battery backed RTC
Date: Wed, 28 Mar 2007 21:55:25 +0100 [thread overview]
Message-ID: <20070328205524.GC12955@linux-mips.org> (raw)
In-Reply-To: <20070328163914.b7187fcb.attila@kinali.ch>
On Wed, Mar 28, 2007 at 04:39:14PM +0200, Attila Kinali wrote:
> Now, this system does not contain a battery backed RTC
> (not enough space) and thus does not know what date/time
> it is after boot. At a later time the device will
> be able to get a time quote from a time server using
> a wireless connection. But as the wireless connection
> is triggered by a user action, it can happen hours after
> boot. This means that there is a quite long period whithin
> which the device does not know what time it is and hence
> assumes it's 1970.
>
> My problem lies now in the back jumps that the device
> makes, when unplugged and replugged. On the filesystem
> there will be files from 2007, while the system still
> thinks it's 1970.
>
> How do you handle this issue with the back jumps, if you
> cannot stick in a batter backed RTC?
Forward jumps are usually much less of a problem. Since your fs is based
on flash you will probably want to avoid writing timestamps all the time
but maybe a quick fs scan for the file with the latest date might provide
a reasonable value for the startup time. At this time you know the actual
time should be newer than this date, so time will only jump forward.
Some standard also defines that time must increase strictly monotonically,
that is of two subsequent calls the second must return the higher time.
So my suggestion would also avoid triggering bugs in code that relies on
this sort of behaviour.
Ralf
prev parent reply other threads:[~2007-03-28 20:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-28 14:39 Power loss and system time when not having a battery backed RTC Attila Kinali
2007-03-28 14:47 ` Markus Gothe
2007-03-28 15:22 ` Attila Kinali
2007-03-28 20:55 ` Ralf Baechle [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=20070328205524.GC12955@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=attila@kinali.ch \
--cc=linux-mips@linux-mips.org \
/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