9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Fix for a timesync buglet....
@ 2003-05-14  2:22 Dan Cross
  0 siblings, 0 replies; only message in thread
From: Dan Cross @ 2003-05-14  2:22 UTC (permalink / raw)
  To: 9fans

I was wondering why ntpdate wouldn't sync from my Plan 9 server
running ``timesync -s /net''.  I figured out that the reference
timestamp field wasn't being filled in the NTP packet that timesync
was sending to ntpdate.  Here's a patch that will fill in the last
UTC sample (if you're sampling a UTC source), which makes ntpdate
and friends happy if you're using a UTC source, and doesn't change
anything if you're not.  It'd be nice to see this applied to the
official timesync.  Thanks!

	- Dan C.

*** /n/dump/2003/0513/sys/src/cmd/aux/timesync.c	Fri Apr 18 21:09:48 2003
--- /sys/src/cmd/aux/timesync.c	Tue May 13 21:38:31 2003
***************
*** 37,42 ****
--- 37,43 ----
  vlong mydisp, rootdisp;
  vlong mydelay, rootdelay;
  vlong avgdelay;
+ vlong lastutc;
  uchar rootid[4];
  char *sysid;

***************
*** 1038,1044 ****
  		gettime(&s, nil, nil);
  		s -= atoll(v[1]);
  	}
! 	return(atoll(v[0]) + s);
  }

  //
--- 1039,1046 ----
  		gettime(&s, nil, nil);
  		s -= atoll(v[1]);
  	}
! 	lastutc = atoll(v[0]) + s;
! 	return(lastutc);
  }

  //
***************
*** 1113,1118 ****
--- 1115,1121 ----
  		ntp->stratum = stratum;
  		hnputfp(ntp->rootdelay, rootdelay + mydelay);
  		hnputfp(ntp->rootdisp, rootdisp + mydisp);
+ 		hnputts(ntp->refts, lastutc);
  		memmove(ntp->origts, ntp->xmitts, sizeof(ntp->origts));
  		hnputts(ntp->recvts, recvts);
  		memmove(ntp->rootid, rootid, sizeof(ntp->rootid));


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-05-14  2:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-14  2:22 [9fans] Fix for a timesync buglet Dan Cross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).