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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux