1 Adapted from the version of ntpclient posted by Linksys
2 at http://www.linksys.com/support/gpl.asp . They claim to
3 use their slightly hacked ntpclient_2000_339 in some of
4 their MIPS/Linux-based wireless routers. It adds static
5 linking of resolv.o, changes the default measurement interval
6 from 10 minutes to 60 minutes, and includes a feeble attempt
7 to port ntpclient to vxWorks.
9 --- Makefile Sun May 18 11:41:25 2003
10 +++ Makefile-linksys Sat Jul 5 12:35:50 2003
12 -# Under Solaris, you need to
13 +# Under Solaris, you need to
15 # LDLIBS += -lnsl -lsocket
16 # Some versions of Linux may need
17 # CFLAGS += -D_GNU_SOURCE
20 +CC=/opt/brcm/hndtools-mipsel-linux/bin/mipsel-linux-gcc
22 # -Wundef not recognized by gcc-2.7.2.3
23 CFLAGS += -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow \
26 ./ntpclient -d -r <test.dat
28 -ntpclient: ntpclient.o phaselock.o
29 +ntpclient: ntpclient.o phaselock.o resolv.o
30 + $(CC) $(CFLAGS) $^ -o $@
34 --- ntpclient.c Sat Jul 5 12:30:17 2003
35 +++ ntpclient-linksys.c Sat Jul 5 12:33:00 2003
37 typedef u_int32_t __u32;
38 #include <sys/timex.h>
40 +#define main ntpclient
41 extern struct hostent *gethostbyname(const char *name);
43 #define herror(hostname) \
45 if ((i!=1)||(!FD_ISSET(usd,&fds))) {
46 if (i==EINTR) continue;
47 if (i<0) perror("select");
48 - if (to.tv_sec == 0) {
49 + if ((to.tv_sec == 0)|| (to.tv_sec == interval)) {
50 if (probes_sent >= num_probes &&
51 num_probes != 0) break;
54 /* These parameters are settable from the command line
55 the initializations here provide default behavior */
56 short int udp_local_port=0; /* default of 0 means kernel chooses */
57 - int cycle_time=600; /* seconds */
58 + int cycle_time=3600; /* seconds */
59 int probe_count=0; /* default of 0 means loop forever */
60 /* int debug=0; is a global above */