[comp.sys.ibm.pc.misc] The old ATT PC6300 clock problem revisited - help needed.

aslakson@cs.umn.edu (Brian Aslakson) (07/28/90)

Well I got out to Mom's, and found the ATTCLKFX has been put into
the public domain, the ASM source is included, and I'm not posting
it because of the size of it (83k for it PAKed, and PAK210.EXE is
91k), but I'll keep them in my directory for as long as I can (and they'll
be on my harddrive at home).  I'll mail them along to the original 
poster (uuencoded, let me know if that's a problem), and anyone who
requests either one.  (If you just need one, let me know).

Anyway, I'll insert some choice comments from the documentation.
Everything down to the signature is quoted:

     ATTCLKFX Version  1.2 is hereby  placed  in the public domain. Neither
     ATTCLKFX or this documentation are copyrighted by the author. ATTCLKFX
     is  intended for  your private  and/or  commercial use.  You may  make
     copies  of the ATTCLKFX program,  both source and executable, and this
     documentation for your own use, and you may copy the files for others.
     You may not, however, charge for such copies, or in any other way sell
     the program or otherwise attempt to make money from it or any modified
     version of it.
     This is freeware in it's truest sense. I ask for  no  compensation for
     your use  of this program.

     The  software  clock maintained in  the BIOS  data  area  at  location
     0040H:006CH  (t_low_order) and  0040H:006EH  (t_hi_order)  is  updated
     18.75 times each second on the AT&T PC 6300. In  terms of minutes this
     equates  to 1125 updates per minute and in terms of hours this equates
     to 67500 updates per hour.

     This presents the following problem:


          The software clock counters, t_low_order and  t_hi_order are wrap
          around counters, that  is, when t_low_order reaches  a  value  of
          65535 it wraps back to  0 and t_hi_order is incremented  by 1  on
          the next  RTC interrupt.  This wrap around is intended to signify
          the changing of the hour.  However, on  the AT&T PC 6300 the hour
          change occurs at 67500 as can be seen in the following formula:

               18.75 * 60 * 60 = 67500
               |       |    |
               |       |    +-- minutes per hour
               |       +-- seconds per minute
               +-- RTC interrupts per second


          Software such as the Right Hand Man  by  Red E Products, Inc. and
          the Reminder Alarm  published  in  the  June 23, 1987,  Volume  6
          Number  12,  issue  of  PC  Magazine utilize  these  counters  as
          follows:

          t_low_order   number  of RTC  interrupts during the current hour.
                        Dividing  the counter by 1093  results in  a  value
                        equivalent to the current minute within the hour.

          t_hi_order    the number of hours elapsed since midnight.

          This is acceptable on an IBM PC because the RTC interrupts  occur
          18.21 times a second not 18.75  times a second  as on the AT&T PC
          6300.  However, the IBM PC clock  will still gain approximately 1
          to 2.5 seconds per hour.

     Another  problem related  to the software  clock is a bug in  the AT&T
     provided MS-DOS 3.1, 3.2 and 3.3 (may also exist in AT&T MS-DOS 2.11).
     The software clock is not set from  the hardware clock during a system
     boot. Instead the  software  clock  represents the time since the last
     system boot. This problem also exists when PC-DOS 3.1 is used with the
     clock driver  CLOCKDEV.SYS  which  may  be found on bulletin boards as
     CLK AT&T.ARC.
-- 
Macintosh related:  mac-admin@cs.umn.edu
All else:  aslakson@cs.umn.edu