---
name: clockspeed
version: 0.62_5
origin: sysutils/clockspeed
comment: Uses a hardware tick counter to compensate for deviant system clock
arch: freebsd:9:x86:64
www: http://cr.yp.to/clockspeed.html
maintainer: lx@FreeBSD.org
prefix: /usr/local
licenselogic: single
flatsize: 85336
desc: |
  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
deps:
  libtai: {origin: devel/libtai, version: 0.60_4}
categories: [sysutils]
files:
  /usr/local/bin/clockadd: 254bc47ea2599b39d8f7965a1592465d518684f8371fa704d6bc004a7e6f0ee4
  /usr/local/bin/clockspeed: b97cb6a81a54ce95bce222c49f391643311239c4efe08a94584ddba89ccdff62
  /usr/local/bin/clockview: c2daa53ca23351696c25c1d1607ccbf5d1848f39be577f848dc972039a0140d6
  /usr/local/bin/sntpclock: e274f0f570e07dd79e0cc734d7fc5eebdd9eba26f3ca1a227c73026cc606668b
  /usr/local/bin/taiclock: c4c28a3e19566d0768541fed714bea4f6e0208f6d5781abd2be4407756493712
  /usr/local/bin/taiclockd: a20cfbfc0064413ea4b309a89d338e122522805501fbb5cf4ac818b79b01f540
  /usr/local/etc/clockspeed/leapsecs.dat: e1745c2571b5e3af38f60e1a6caf4cf02cdae103cfd52defa8dfa6d5b1fe0e22
  /usr/local/etc/rc.d/clockspeed.sh.sample: 1b63e12b6ca361197372718fe63225d959e38fb31410293e2408c16bff600877
  /usr/local/man/man1/clockadd.1.gz: 264c522af5d9573fc34b5b0c660bbdf84ac0d2f418b28b87e0d32852bb94229e
  /usr/local/man/man1/clockspeed.1.gz: 4bf8f6afe874e327ae8b8f70325e6b9e3e9bc8cc8e05c6fcd5b54ff060547568
  /usr/local/man/man1/clockview.1.gz: 03439cd584eb18cfdebff04c33cedb4e51c0bffbb735807996262d7c84a37721
  /usr/local/man/man1/sntpclock.1.gz: 82ab2fde636c0c36d2f638dd2929a2a86f3fbd6a4f19f4c5f0130d15e832dffe
  /usr/local/man/man1/taiclock.1.gz: 60b812806220ee4fba11a0f1d66dbed025a1d8d6d219db0b76968c9172921e96
  /usr/local/man/man1/taiclockd.1.gz: a5f47db58a64631fcfab7e52482d76ccc8f09a55ac9520326043a8ce157ec395
  /usr/local/share/doc/clockspeed/INSTALL: 28fe728dd55fa7a30ebe4f062cc29ccbcfb948e1dacad52fc8d1a0a49c1f6f7c
  /usr/local/share/doc/clockspeed/INSTALL-FreeBSD: eb595e9f3b958e8f49bb398c7725051a84e6b89aa33b52fe68e76bb1aea3eb0d
directories:
  /usr/local/share/doc/clockspeed/: n
  /usr/local/etc/clockspeed/: y
scripts:
  post-install: |
    mkdir /usr/local/etc/clockspeed
  pre-deinstall: |
    if [ -f /usr/local/etc/rc.d/clockspeed.sh ]; then cmp -s /usr/local/etc/rc.d/clockspeed.sh.sample /usr/local/etc/rc.d/clockspeed.sh && rm -f /usr/local/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
    rm /usr/local/etc/clockspeed/atto.tmp 2>/dev/null || true
    rm /usr/local/etc/clockspeed/atto 2>/dev/null || true
    rm /usr/local/etc/clockspeed/adjust 2>/dev/null || true
message: "\tATTENTION\b\b\b\b\b\b\b\b\bATTENTION:\n\nPlease make sure that you read
  /usr/local/share/doc/clockspeed/INSTALL.\nIt contains important information about
  testing and configuring\nclockspeed, and finally installing it in your system.\n\nClockspeed
  uses the libtai library, check /usr/ports/devel/libtai\nfor more details. TAI time
  measure is off 22 seconds from UTC time\nmeasure. Therefore, your system time will
  show a 22 secs difference\nfrom your time source after you've installed this port.\n\nTo
  fix this, you could follow this simple recipe created with\nPR ports/27617.\n\n1)
  killall clockspeed (you can't have it running)\n2) sntpclock IP.OF.NTP.SERVER |
  clockadd\n3) enable/start clockspeed :\n\t%25 cp /usr/local/etc/rc.d/clockspeed.sh.sample
  \\\n\t  /usr/local/etc/rc.d/clockspeed.sh\n\t# enable clockspeed to automagically
  start next\n\t# time you reboot. do this after testing everything\n\t%25 /usr/local/etc/rc.d/clockspeed.sh
  start\n\t# start clockspeed now\n4) sntpclock IP.OF.NTP.SERVER > /usr/local/etc/clockspeed/adjust\n5)
  cd /usr/src/share/zoneinfo\n6) make -DLEAPSECONDS clean all install ; make clean\n\nStep
  5 and 6 build support in your system for leapseconds handling.\nTake a note about
  this since you might forget later to disable it\nif you remove this port. To disable
  it, simply re-do step 6 without\n-DLEAPSECONDS.\nStep 6 should not break anything
  but you can disable it anytime\nas per last paragraph if you think something unusual
  has happened\nto your system.\n \n7) /stand/sysinstall -> configure -> time zone
  (choose the correct\n   time zone for your system)\n8) sntpclock IP.OF.NTP.SERVER
  | clockview\n\nCheck how close is your clock before and after now. Should be\nwithin
  milliseconds.\n\nDo not forget to add a cron(8) job with step 4 to periodically\nadjust
  clockspeed's drift rate. Once a week should be more than\nadequate.\n\nA port to
  non-i386 platforms was done using the clock_gettime(2)\nfunction. Since this is
  somewhat experimental, there might be some\ntiny precision differences from the
  i386 platform versions. You\nhave been warned!\n"
