Thread (4 messages) 4 messages, 3 authors, 2007-03-28

Re: Power loss and system time when not having a battery backed RTC

From: Ralf Baechle <hidden>
Date: 2007-03-28 20:55:43

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help