pkg-descr

clockspeed uses a hardware tick counter to compensate for a persistently
fast or slow system clock. Given a few time measurements from a reliable
source, it computes and then eliminates the clock skew.

sntpclock checks another system's NTP clock, and prints the results in a
format suitable for input to clockspeed. sntpclock is the simplest
available NTP/SNTP client.

taiclock and taiclockd form an even simpler alternative to SNTP. They
are suitable for precise time synchronization over a local area network,
without the hassles and potential security problems of an NTP server.

This version of clockspeed can use the Pentium RDTSC tick counter or the
Solaris gethrtime() nanosecond counter.

A port to non-i386 platforms was done using the clock_gettime(2)
function. Since this is somewhat experimental, there might be some
tiny precision differences from the i386 platform versions. You
have been warned!

WWW: http://cr.yp.to/clockspeed.html

pkg-message

ATTENTIONATTENTION:

Please make sure that you read /usr/local/share/doc/clockspeed/INSTALL.
It contains important information about testing and configuring
clockspeed, and finally installing it in your system.

Clockspeed uses the libtai library, check /usr/ports/devel/libtai
for more details. TAI time measure is off 22 seconds from UTC time
measure. Therefore, your system time will show a 22 secs difference
from your time source after you've installed this port.

To fix this, you could follow this simple recipe created with
PR ports/27617.

1) killall clockspeed (you can't have it running)
2) sntpclock IP.OF.NTP.SERVER | clockadd
3) enable/start clockspeed :
% cp /usr/local/etc/rc.d/clockspeed.sh.sample \
/usr/local/etc/rc.d/clockspeed.sh
# enable clockspeed to automagically start next
# time you reboot. do this after testing everything
% /usr/local/etc/rc.d/clockspeed.sh start
# start clockspeed now
4) sntpclock IP.OF.NTP.SERVER > /usr/local/etc/clockspeed/adjust
5) cd /usr/src/share/zoneinfo
6) make -DLEAPSECONDS clean all install ; make clean

Step 5 and 6 build support in your system for leapseconds handling.
Take a note about this since you might forget later to disable it
if you remove this port. To disable it, simply re-do step 6 without
-DLEAPSECONDS.
Step 6 should not break anything but you can disable it anytime
as per last paragraph if you think something unusual has happened
to your system.

7) /stand/sysinstall -> configure -> time zone (choose the correct
time zone for your system)
8) sntpclock IP.OF.NTP.SERVER | clockview

Check how close is your clock before and after now. Should be
within milliseconds.

Do not forget to add a cron(8) job with step 4 to periodically
adjust clockspeed's drift rate. Once a week should be more than
adequate.

A port to non-i386 platforms was done using the clock_gettime(2)
function. Since this is somewhat experimental, there might be some
tiny precision differences from the i386 platform versions. You
have been warned!

pkg-plist

bin/clockadd
bin/clockspeed
bin/clockview
bin/sntpclock
bin/taiclock
bin/taiclockd
%%PORTDOCS%%%%DOCSDIR%%/INSTALL
%%PORTDOCS%%%%DOCSDIR%%/INSTALL-FreeBSD
%%PORTDOCS%%@dirrm %%DOCSDIR%%
@mode 0755
@exec mkdir %D/etc/clockspeed
etc/clockspeed/leapsecs.dat
@unexec if [ -f %D/etc/rc.d/clockspeed.sh ]; then cmp -s %D/etc/rc.d/clockspeed.sh.sample %D/etc/rc.d/clockspeed.sh && rm -f %D/etc/rc.d/clockspeed.sh || echo "If you are permanently removing this port, you should do a ``rm -f ${PKG_PREFIX}/etc/rc.d/clockspeed.sh`` to remove startup files left." | fmt ; fi
etc/rc.d/clockspeed.sh.sample
@unexec rm %D/etc/clockspeed/atto.tmp 2>/dev/null || true
@unexec rm %D/etc/clockspeed/atto 2>/dev/null || true
@unexec rm %D/etc/clockspeed/adjust 2>/dev/null || true
@unexec rmdir %D/etc/clockspeed 2>/dev/null || echo "If you are permanently removing this port, you should do a ``rm -Rf ${PKG_PREFIX}/etc/clockspeed`` to remove any configuration files left." | fmt