Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Aug 2013 11:30:22 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        arch@FreeBSD.org
Subject:   Re: suspend/resume time-gap and expiration timers in network stack
Message-ID:  <20130818101945.T880@besplex.bde.org>
In-Reply-To: <10980.1376759837@critter.freebsd.dk>
References:  <20130817.173019.1478850854128616078.hrs@allbsd.org> <20130818004948.L4326@besplex.bde.org> <10980.1376759837@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 17 Aug 2013, Poul-Henning Kamp wrote:

> In message <20130818004948.L4326@besplex.bde.org>, Bruce Evans writes:
>
>>     The boot time is then set to the real time,
>>     to maintain the (buggy) invariant real_time = monotonic_time + boottime.
>
>>      real_time = monotonic_time + base_time
>
> That was a lot of verbiage just to change the name of a variable :-)

No, it just wasn't verbose enough to describe the full details for the
boottime[bin,etc] variable.  It must be maintained (with fixes) for use
by the kern.boottime sysctl.  In general, every clock id may have a
different base with different initialization requirements.

The bases for CLOCK_MONOTONIC and CLOCK_REALTIME differ by leap seconds
and not much more.  To avoid adding the base to the monotonic time
every time it is used, the base for the monotonic time should be 0,
with the offset from the boot time part of the timehands.  You even
get a free optimization from this.  The difference between
CLOCK_REALTIME and CLOCK_MONOTONIC becomes just the leap seconds
adjustment.  This is an integer, so it is easier to lock and more
efficient to add than a full bintime.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130818101945.T880>