From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3E7432B3.2050805@powell.name> From: Richard Powell User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827 MIME-Version: 1.0 To: 9fans <9fans@cse.psu.edu> Subject: Re: [9fans] timesync is slow to set the time after boot References: <3E72CCA8.2030605@powell.name> <0c96ecd2b95642b0199eacca2aaea7ba@plan9.bell-labs.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 16 Mar 2003 00:15:47 -0800 Topicbox-Message-UUID: 80feb72c-eacb-11e9-9e20-41e7f4b1d025 David, If there are problems reading the clock on the first pass, maybe we could just wait one second between passes instead of one minute. (Or even zero seconds if you think that's safe enough.). Thanks for looking into this. Richard diff -c timesync.org timesync.c.tsecs0 *** timesync.c.org Fri Mar 14 19:42:32 2003 --- timesync.c.tsecs1 Sun Mar 16 00:05:10 2003 *************** *** 344,349 **** --- 344,350 ---- break; case Rtc: s->stime = sample(rtctime); + tsecs = 1; break; case Utc: s->stime = utcsample(); *************** *** 385,391 **** diff = s->stime - s->ltime; if(diff > 10*SEC || diff < -10*SEC){ // we're way off, just set the time ! secs = MinSampleSecs; settime(s->stime, 0, 0, 0); } else { // keep a running average of the error. --- 386,392 ---- diff = s->stime - s->ltime; if(diff > 10*SEC || diff < -10*SEC){ // we're way off, just set the time ! tsecs = secs = MinSampleSecs; settime(s->stime, 0, 0, 0); } else { // keep a running average of the error. David Presotto wrote: > I stopped ignoring the first sample. It made some difference since the > first sample is usually perverted a bit by the system starting up. However, > it really doesn't help to have a wrong time for a minute. Thanks powell. >