[comp.protocols.time.ntp] fixes to refclock_wwvb.c and tty_clk.c

nrh@buzz.bellcore.com (Nat Howard) (08/23/90)

Hello...

I spent a fair amount of time trying to make a WWVB clock work correctly.
To do this on a VAX running 4.3 tahoe, you'll need to patch the device
driver tty_clk.c, so that it turns the integer representation of the 
incoming information into a true character.

Also, there's a bug in refclock_wwvb.c which passes "off" rather than
"offset" to refclock_receive, resulting in impossibly large values of
offset for the clock.

I trust everyone will jump all over me if I've made an error...

Here's the patch to kernel/tty_clk.c:

*** /tmp/d05391	Wed Aug 22 16:19:05 1990
--- tty_clk.c	Wed Aug 22 14:17:34 1990
***************
*** 159,164 ****
--- 159,167 ----
  	register long s;
  	struct timeval tv;
  
+ 	/* just in case, get rid of high-order bits */
+ 	c &= 0377;
+ 	c = (char) c;	/* and re-express it as if it were a byte */
  	/*
  	 * Check to see whether this isn't the magic character.  If not,
  	 * save the character and return.



Here's the patch to xntpd/refclock_wwvb.c

*** /tmp/d05440	Wed Aug 22 16:19:31 1990
--- refclock_wwvb.c	Wed Aug 22 14:05:09 1990
***************
*** 1235,1241 ****
  	 * Done.  Use codetime as the reference time and lastsampletime
  	 * as the receive time.
  	 */
! 	refclock_receive(wwvb->peer, &off, delay, &wwvb->codetime,
  	    &wwvb->lastsampletime, isinsync);
  
  	if (wwvb->unsynccount != 0)
--- 1235,1241 ----
  	 * Done.  Use codetime as the reference time and lastsampletime
  	 * as the receive time.
  	 */
! 	refclock_receive(wwvb->peer, &offset, delay, &wwvb->codetime,
  	    &wwvb->lastsampletime, isinsync);
  
  	if (wwvb->unsynccount != 0)