readclock(8)


NAME
     readclock - read the AT's real time clock

SYNOPSIS
     readclock [-bcnw]

DESCRIPTION
     Readclock reads the AT's real time clock and sets the machine's time.  It
     is  usually  the second thing done in /etc/rc, the first thing is setting
     the time zone by sourcing /etc/timeinfo.  This means that  the  clock  is
     assumed to tell the wall clock time.  If you want to run the clock in GMT
     then you can set  the  TZ  boot  environment  variable  to  GMT  to  tell
     readclock  the  time  zone  the  hardware clock is running in.  Any other
     timezone is possible too, so you can run the clock  in  winter  time  for
     instance.

     /etc/timeinfo is also the place where readclock looks for information  on
     how  to  calibrate a badly running clock.  This information consists of a
     base and two offsets.  The base  is  the  time  the  internal  clock  was
     exactly  equal  to  wall  clock  time,  the first offset is the number of
     seconds the hardware clock has ticked since the last time it was correct,
     the  second offset is the number of seconds it should have ticked.  These
     offsets are used to compute the clock gain or loss since the base time.

OPTIONS

     -b   Rebase.  The hardware clock has been adjusted to the  current  time,
          so  a  new  base  needs  to  be used.  Before doing this or the next
          option, first set the time of the system using date(1), or stime(1).

     -c   Calibrate.  The correction offsets must  be  recomputed.   Run  this
          just  now  and  then to recompute the calibration offsets.  The more
          time between this and the last rebase the better.

     -n   Play-act, don't set the time nor change the calibration  data,  just
          show what would be done.

     -w   Write the current time to the CMOS clock.  Dangerous, see BUGS.

     -W   Like -w, but also sets the status registers of  the  CMOS  clock  to
          their proper values.  (For if the clock suddenly runs at an odd pace
          or has stopped and the BIOS doesn't repair it.)

  How To Calibrate
     First set system time precisely with date or stime.  Then use the -w  and
     -b  options  to  set  the  hardware clock and the calibration base to the
     current time, like this:  readclock -bw.



     After a week or so when the clock's mistake  becomes  apparent,  set  the
     system  time  again  with  date  or  stime and run readclock -c.  You can
     repeat this every now and then to set the offsets more accurately.

     If after some time you want to set the hardware clock  right  again,  set
     system  time and rerun readclock -bw.  You don't need to run readclock -c
     anymore after this, the offsets are now known.

FILES

     /etc/timeinfo       Timezone and calibration data.

SEE ALSO
     date(1), utime(1), rdate(8).

BUGS
     Reported to not work on some AT's.

     May mess up the clock royally when setting it (-w).  Only if you  have  a
     very  standard  AT and you are not afraid of having your CMOS setup reset
     to the default with a "checksum error" should you use  readclock  to  set
     the time of the CMOS clock.  You have been warned.

     The clock must be reliably wrong for the calibration to work.

AUTHOR
     Kees J. Bot (kjb@cs.vu.nl)