svn commit: r337334 - head/lib/libc/sys

Warner Losh imp at bsdimp.com
Sun Aug 5 02:41:19 UTC 2018


On Sat, Aug 4, 2018 at 5:01 PM, Warner Losh <imp at bsdimp.com> wrote:

>
>
> On Sat, Aug 4, 2018, 11:48 PM Conrad Meyer <cem at freebsd.org> wrote:
>
>> If not stale, it was inaccurate as-is.  It seems to be used by a bunch
>> of different clock-related drivers and routines, e.g.,
>>
>> $ rg '(tz_minuteswest|tz_dst|utc_offset)' | wc -l
>>       36
>>
>
> Right. Nothings sets it any more though and hasn't in 30 years. Adjkerntz
> is what is used today. The other code was left for still lingering legacy
> uses in the early 1990s...
>

Amplifying a bit, This was introduced around 4.2BSD, along with a compiled
in default TIMEZONE to replace the older ftime from Version 7 which itself
was an improvement on Verison 6's gtime routines (etc, there's been a lot
of churn in this area unlike 'open' or 'read'). It was used by localtime()
to offset the system time by this value to get local time. You could
compile it into the kernel, or set it with date -t. troff also used it in
one place. Otherwise, the kernel just provided an interface for userland to
get this value (gettimeofday) and set it (settimeofday). This continued in
4.3BSD pretty much the same. Then in 4.4BSD David Olson's TZ stuff went in,
and it became obsolete (so with FreeBSD 1.0).

NetBSD has eliminated the variable, and returns 0's. This is what I'm
advocating that FreeBSD do.

phk introduced utc_offset() in r62962 (12 years ago) to consolidate people
doing the adjkerntz stuff all over the tree. As part of this work, he moved
tz_minuteswest and tz_dsttime from sys/kernel.h to sys/clock.h. This itself
is an earlier cleanup which broke part tz into tz_minueswest and tz_dsttime
in r110299 (15 years ago). This appears to have been inspired by getting
them out from under Giant. tz itself originated with the 4.4 import at the
dawn of the project. Why phk didn't just delete them at any number of these
weigh points, I can only speculate. They were kinda sorta in use in FreeBSD
since early days for various RTC things. TIMEZONE (from 4.x BSD days) was
eliminated from config in 1995 by dg with the introduction of adjkerntz
which was supposed to be controlling for this offset.

This is a longer way of saying, we can kill it, along with way too much
historical detail.

Warner


More information about the svn-src-all mailing list