summaryrefslogtreecommitdiff
path: root/sysutils/clockspeed
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2000-07-07 14:30:01 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2000-07-07 14:30:01 +0000
commitdf6c5fd47c2998f6ce167585be019978da841983 (patch)
treea1175fe8c4da5132d23c9bda9f830631ac96d3d6 /sysutils/clockspeed
parentAdd libtai - a library for storing and manipulating dates and times in second... (diff)
Add clockspeed - a program which uses a hardware tick counter to compensate
for a persistently fast or slow system clock. It also could be used to synchronize time across LAN or WAN. PR: 19349 Submitted by: Mario Sergio Fujikawa Ferreira <lioux@uol.com.br>
Notes
Notes: svn path=/head/; revision=30298
Diffstat (limited to 'sysutils/clockspeed')
-rw-r--r--sysutils/clockspeed/Makefile44
-rw-r--r--sysutils/clockspeed/distinfo1
-rw-r--r--sysutils/clockspeed/files/patch-aa44
-rw-r--r--sysutils/clockspeed/files/patch-ab31
-rw-r--r--sysutils/clockspeed/files/patch-ac29
-rw-r--r--sysutils/clockspeed/files/patch-ad58
-rw-r--r--sysutils/clockspeed/pkg-comment1
-rw-r--r--sysutils/clockspeed/pkg-descr16
-rw-r--r--sysutils/clockspeed/pkg-plist13
9 files changed, 237 insertions, 0 deletions
diff --git a/sysutils/clockspeed/Makefile b/sysutils/clockspeed/Makefile
new file mode 100644
index 000000000000..51f0f00c4be5
--- /dev/null
+++ b/sysutils/clockspeed/Makefile
@@ -0,0 +1,44 @@
+# New ports collection makefile for: clockspeed
+# Date created: 16 June 2000
+# Whom: Mario S F Ferreira <lioux@linf.unb.br> et al.
+#
+# $FreeBSD$
+#
+
+PORTNAME= clockspeed
+PORTVERSION= 0.62
+CATEGORIES= sysutils
+MASTER_SITES= http://cr.yp.to/clockspeed/
+
+MAINTAINER= lioux@linf.unb.br
+
+LIB_DEPENDS= tai.1:${PORTSDIR}/devel/libtai
+
+ALL_TARGET= it
+INSTALL_TARGET= setup check
+
+MAN1= clockadd.1 clockspeed.1 clockview.1 sntpclock.1 \
+ taiclock.1 taiclockd.1
+
+.if defined(NOPORTDOCS)
+PLIST_SUB+= PORTDOCS:="@comment "
+.else
+PLIST_SUB+= PORTDOCS:=
+.endif
+
+do-configure:
+ @${PERL} -pi -e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/INSTALL
+ @${ECHO} ${CC} ${CFLAGS} > ${WRKSRC}/conf-cc
+ @${ECHO} ${CC} -s -L${LOCALBASE}/lib > ${WRKSRC}/conf-ld
+ @${ECHO} ${PREFIX} > ${WRKSRC}/conf-home
+
+post-install:
+.if !defined(NOPORTDOCS)
+ @${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} -m 755 \
+ ${PREFIX}/share/doc/clockspeed
+ @${INSTALL_DATA} ${WRKSRC}/INSTALL ${PREFIX}/share/doc/clockspeed
+.endif
+ @${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} -m 755 \
+ ${PREFIX}/etc/clockspeed
+
+.include <bsd.port.mk>
diff --git a/sysutils/clockspeed/distinfo b/sysutils/clockspeed/distinfo
new file mode 100644
index 000000000000..adcecffd3592
--- /dev/null
+++ b/sysutils/clockspeed/distinfo
@@ -0,0 +1 @@
+MD5 (clockspeed-0.62.tar.gz) = 425614174fcfe2ad42d22d3d02e2d567
diff --git a/sysutils/clockspeed/files/patch-aa b/sysutils/clockspeed/files/patch-aa
new file mode 100644
index 000000000000..4483dda53433
--- /dev/null
+++ b/sysutils/clockspeed/files/patch-aa
@@ -0,0 +1,44 @@
+--- Makefile.orig Fri Jun 16 22:21:58 2000
++++ Makefile Fri Jun 16 22:23:28 2000
+@@ -293,10 +293,10 @@
+ chmod 400 shar
+
+ sntpclock: \
+-load sntpclock.o ip.o libtai.a strerr.a substdio.a error.a str.a fs.a \
++load sntpclock.o ip.o strerr.a substdio.a error.a str.a fs.a \
+ socket.lib
+- ./load sntpclock ip.o libtai.a strerr.a substdio.a error.a \
+- str.a fs.a `cat socket.lib`
++ ./load sntpclock ip.o strerr.a substdio.a error.a \
++ str.a fs.a `cat socket.lib` -ltai
+
+ sntpclock.0: \
+ sntpclock.1
+@@ -406,10 +406,10 @@
+ ./compile taia_unpack.c
+
+ taiclock: \
+-load taiclock.o ip.o libtai.a strerr.a substdio.a error.a str.a fs.a \
++load taiclock.o ip.o strerr.a substdio.a error.a str.a fs.a \
+ socket.lib
+- ./load taiclock ip.o libtai.a strerr.a substdio.a error.a \
+- str.a fs.a `cat socket.lib`
++ ./load taiclock ip.o strerr.a substdio.a error.a \
++ str.a fs.a `cat socket.lib` -ltai
+
+ taiclock.0: \
+ taiclock.1
+@@ -421,10 +421,10 @@
+ ./compile taiclock.c
+
+ taiclockd: \
+-load taiclockd.o libtai.a strerr.a substdio.a error.a str.a \
++load taiclockd.o strerr.a substdio.a error.a str.a \
+ socket.lib
+- ./load taiclockd libtai.a strerr.a substdio.a error.a \
+- str.a `cat socket.lib`
++ ./load taiclockd strerr.a substdio.a error.a \
++ str.a `cat socket.lib` -ltai
+
+ taiclockd.0: \
+ taiclockd.1
diff --git a/sysutils/clockspeed/files/patch-ab b/sysutils/clockspeed/files/patch-ab
new file mode 100644
index 000000000000..26a7d2587e46
--- /dev/null
+++ b/sysutils/clockspeed/files/patch-ab
@@ -0,0 +1,31 @@
+--- hier.c.orig Tue Oct 13 20:37:49 1998
++++ hier.c Fri Jul 7 17:22:26 2000
+@@ -2,16 +2,6 @@
+
+ void hier()
+ {
+- c("/","etc","leapsecs.dat",-1,-1,0644);
+-
+- h(auto_home,-1,-1,0755);
+-
+- d(auto_home,"etc",-1,-1,0755);
+- d(auto_home,"bin",-1,-1,0755);
+- d(auto_home,"man",-1,-1,0755);
+- d(auto_home,"man/man1",-1,-1,0755);
+- d(auto_home,"man/cat1",-1,-1,0755);
+-
+ c(auto_home,"bin","clockspeed",-1,-1,0755);
+ c(auto_home,"bin","clockadd",-1,-1,0755);
+ c(auto_home,"bin","clockview",-1,-1,0755);
+@@ -25,11 +15,4 @@
+ c(auto_home,"man/man1","sntpclock.1",-1,-1,0644);
+ c(auto_home,"man/man1","taiclock.1",-1,-1,0644);
+ c(auto_home,"man/man1","taiclockd.1",-1,-1,0644);
+-
+- c(auto_home,"man/cat1","clockspeed.0",-1,-1,0644);
+- c(auto_home,"man/cat1","clockadd.0",-1,-1,0644);
+- c(auto_home,"man/cat1","clockview.0",-1,-1,0644);
+- c(auto_home,"man/cat1","sntpclock.0",-1,-1,0644);
+- c(auto_home,"man/cat1","taiclock.0",-1,-1,0644);
+- c(auto_home,"man/cat1","taiclockd.0",-1,-1,0644);
+ }
diff --git a/sysutils/clockspeed/files/patch-ac b/sysutils/clockspeed/files/patch-ac
new file mode 100644
index 000000000000..60237f121c61
--- /dev/null
+++ b/sysutils/clockspeed/files/patch-ac
@@ -0,0 +1,29 @@
+--- clockspeed.c.orig Fri Jun 16 23:37:32 2000
++++ clockspeed.c Fri Jun 16 23:38:10 2000
+@@ -83,7 +83,7 @@
+ if (deriv <= 0) return;
+ if (deriv > 200000000) return; /* 5Hz ticks? be serious */
+
+- fd = open_trunc("etc/atto.tmp");
++ fd = open_trunc("etc/clockspeed/atto.tmp");
+ if (fd == -1) return;
+
+ buf[0] = 0;
+@@ -119,7 +119,7 @@
+ if (fsync(fd) == -1) { close(fd); return; }
+ if (close(fd) == -1) return; /* NFS stupidity */
+
+- rename("etc/atto.tmp","etc/atto"); /* if it fails, bummer */
++ rename("etc/clockspeed/atto.tmp","etc/clockspeed/atto"); /* if it fails, bummer */
+ }
+
+ void main()
+@@ -136,7 +136,7 @@
+ if (chdir(auto_home) == -1) _exit(1);
+ umask(033);
+
+- if (open_read("etc/atto") == 0) {
++ if (open_read("etc/clockspeed/atto") == 0) {
+ r = read(0,buf,sizeof buf);
+ if (r == sizeof buf)
+ deriv = nano(buf);
diff --git a/sysutils/clockspeed/files/patch-ad b/sysutils/clockspeed/files/patch-ad
new file mode 100644
index 000000000000..52cd9386d83b
--- /dev/null
+++ b/sysutils/clockspeed/files/patch-ad
@@ -0,0 +1,58 @@
+--- INSTALL.orig Fri Jun 16 23:36:18 2000
++++ INSTALL Fri Jun 16 23:46:18 2000
+@@ -5,7 +5,7 @@
+ Things you have to decide before starting:
+
+ * Where the clockspeed package will be installed, normally
+-/usr/local/clockspeed. To change this directory, edit conf-home now.
++%%PREFIX%%. To change this directory, edit conf-home now.
+
+
+ How to install:
+@@ -16,9 +16,9 @@
+ or with gethrtime(). The compiler must support a 64-bit type, either
+ long or long long.
+
+- 2. Install the programs, the man pages, and /etc/leapsecs.dat:
++ 2. Install the programs, the man pages, and %%PREFIX%%/etc/leapsecs.dat:
+ # make setup check
+- Put /usr/local/clockspeed/bin into $PATH.
++ Put %%PREFIX%%/bin into $PATH.
+
+
+ How to test:
+@@ -39,20 +39,20 @@
+ 5. Start clockspeed:
+ # clockspeed &
+ Give clockspeed a time measurement:
+- # sntpclock 1.2.3.4 > /usr/local/clockspeed/adjust &
++ # sntpclock 1.2.3.4 > %%PREFIX%%/etc/clockspeed/adjust &
+
+ 6. After a few hours, give clockspeed a second time measurement:
+- # sntpclock 1.2.3.4 > /usr/local/clockspeed/adjust &
++ # sntpclock 1.2.3.4 > %%PREFIX%%/etc/clockspeed/adjust &
+ You can run sntpclock as a non-root user, if you change
+- /usr/local/clockspeed/adjust to be owned by that user. I recommend
++ %%PREFIX%%/etc/clockspeed/adjust to be owned by that user. I recommend
+ this for security.
+
+ 7. After a few days, check how well clockspeed has adjusted your clock:
+ % sntpclock 1.2.3.4 | clockview
+ Check how many attoseconds clockspeed thinks are in one tick:
+- % clockview < /usr/local/clockspeed/etc/atto
++ % clockview < %%PREFIX%%/etc/clockspeed/atto
+ Give it another time measurement:
+- # sntpclock 1.2.3.4 > /usr/local/clockspeed/adjust &
++ # sntpclock 1.2.3.4 > %%PREFIX%%/etc/clockspeed/adjust &
+
+ 8. Repeat step 7 after a few weeks, then after a few months. Your clock
+ should now be synchronized to the remote clock to within a few
+@@ -70,7 +70,7 @@
+ Here 5.6.7.8 is the master's IP address. Set the client's clock:
+ # clockadd < adjustment
+ Finally, run clockspeed as in step 5, and do
+- % taiclock 5.6.7.8 > /usr/local/clockspeed/adjust &
++ % taiclock 5.6.7.8 > %%PREFIX%%/etc/clockspeed/adjust &
+ after a few days.
+
+
diff --git a/sysutils/clockspeed/pkg-comment b/sysutils/clockspeed/pkg-comment
new file mode 100644
index 000000000000..45a9cbc749f9
--- /dev/null
+++ b/sysutils/clockspeed/pkg-comment
@@ -0,0 +1 @@
+Uses a hardware tick counter to compensate for deviant system clock
diff --git a/sysutils/clockspeed/pkg-descr b/sysutils/clockspeed/pkg-descr
new file mode 100644
index 000000000000..c2e390dc5072
--- /dev/null
+++ b/sysutils/clockspeed/pkg-descr
@@ -0,0 +1,16 @@
+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.
+
+WWW: http://cr.yp.to/clockspeed.html
diff --git a/sysutils/clockspeed/pkg-plist b/sysutils/clockspeed/pkg-plist
new file mode 100644
index 000000000000..c724945af071
--- /dev/null
+++ b/sysutils/clockspeed/pkg-plist
@@ -0,0 +1,13 @@
+bin/clockadd
+bin/clockspeed
+bin/clockview
+bin/sntpclock
+bin/taiclock
+bin/taiclockd
+%%PORTDOCS:%%share/doc/clockspeed/INSTALL
+%%PORTDOCS:%%@dirrm share/doc/clockspeed
+@mode 0755
+@exec mkdir %D/etc/clockspeed
+@unexec rm %D/etc/clockspeed/atto.tmp 2>/dev/null || true
+@unexec rm %D/etc/clockspeed/atto 2>/dev/null || true
+@unexec rmdir %D/etc/clockspeed 2>/dev/null || true