suspend/resume time-gap and expiration timers in network stack

Bruce Evans brde at optusnet.com.au
Sun Aug 18 01:30:37 UTC 2013


On Sat, 17 Aug 2013, Poul-Henning Kamp wrote:

> In message <20130818004948.L4326 at 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


More information about the freebsd-arch mailing list