Re: [Bug 764] New: btime in /proc/stat wobbles (even over 30 seconds)

Kingsley Cheung
2003-06-06T11:55:28Z

On Fri, Jun 06, 2003 at 06:32:04PM +1000, Herbert Xu wrote:
> Kingsley Cheung <kingsley@aurema.com> wrote:
> >
> > Attached is a trivial patch to fix the problem against 2.5.70. I've
> > also attached the trivial 2.4.20 patch I sent to Rusty back for
> > completeness.
>
> What happens when the system time is changed later on?

Well, without the patch the boottime would change as you change the
system time. So if you set the system time forward an hour, your
boottime would go forward as well, and so forth.

With the patch, the boottime would remain the same regardless of
changes to the system time. IMHO, this is probably for the better,
since now as it stands we have issues with the boottime changing under
us due to the way xtime and jiffies are updated. To me, having an
unchanging boottime is more profitable than one that changes.
Applications could use the value as a reliable absolute time
reference. For example, to find out the absolute time a process
started, you can add the boottime and the starttime of the process,
the latter being in jiffies after the system booted, and not expect
this value to change.

The tradeoff, though, is that it is possible to have the boottime
greater than the current time if you set the system time back enough.
I think setting it forward is a non-issue. I could be wrong but so
far I believe that is worth putting up this with tradeoff given the
benefits of an unchanging boottime time. There is no affect obtaining
the system uptime - people shouldn't go calculating system time minus
boottime, since uptime itself is provided. Moreover, a similar
problem is what to do with file modification times in the future - we
do nothing.

What do you or others think? If people wanted to keep the old
semantics of a boottime that changed with the system time then we'll
need another way to avoid the wobble.

--
Kingsley