9fans archive / 1996 / 10 / 56 / prev next
From: presotto@pla... presotto@pla...
Subject: Keeping the fileserver's clock straight
Date: Thu, 17 Oct 1996 09:49:45 -0400
fs used to call a clock server via datakit once every
few (I think 3) hours. Datakit isn't exactly the most
ubiquitous network though. What I've done lately with ours
is to just have it check the time of day clock. Works
well on our current boxes since the tod clocks don't seem
to drift much. Here's the changes, such as they are. I'm
not doing a boddle since there are some other changes in
there that I don't know the origin of:
in wormcopy() of main.c
% diff main.c /n/juke/plan_9/sys/src/fs/port
305c305
< long nddate, ntoytime, t, dt;
---
> long nddate, t, dt;
316,317d315
< ntoytime = time() + HOUR(1);
<
330,342d327
<
< if(t > ntoytime) {
< dt = time() - rtctime();
< if(dt < 0)
< dt = -dt;
< if(dt > 10)
< print("rtc time more than 10 secounds out\n");
< else
< if(dt > 1)
< settime(rtctime());
< ntoytime = time() + HOUR(1);
< goto loop;
< }
in cmd_date() of con.c, set rtc in addition to normal time.
% diff con.c /n/juke/plan_9/sys/src/fs/port
416,417d415
< setrtc(ct);
<