[comp.sys.att] How does DOS time work?

Robb.Thomas@f1.n684.z89.onebdos.UUCP (Robb Thomas) (05/31/90)

 > From: gopstein@soleil.UUCP (Rich Gopstein)
 > Date: 24 May 90 13:28:16 GMT
 > Organization: Harris Semiconductor, Somerville, NJ
 > Message-ID: <962@soleil.UUCP>
 > Newsgroups: comp.sys.ibm.pc.programmer,comp.sys.att
 >
 >
 >   I am having problems getting an accurate time-of-day clock on my ATT
 > 6300.  Since the internal 6300 clock (and AT&T's MSDOS) cannot have
 > their seconds set, and when the machine reboots, it resets the H/W
 > clock's seconds to zero, I can't keep accurate time.  I've installed a
 > separate clock card, and am now running Microsoft MS-DOS (generic from
 > Phoenix).

     I have ran into simular time problems on AT&T PC-6300's.  ATT Dos is 
very diferent from the generic MS/PC DOS being run elsewhere.  First of all, 
it looks at the AT&T 6300's internal hardware clock, whenever the time is 
checked.  (I tried running AT&T ver 3.1 on a generic clone & could not 
figure out why 'TIME STOOD STILL' <GRIN>).

     This means that when you are running under AT&T DOS, installing a clock 
card does NOTHING for you as AT&T DOS is constantly looking at it's own 
internal hardware clock.

      You should try booting your machine off floppy under a 'generic' 
version of MS-DOS.  Next, run your clock utilities off the floppy, and POOF, 
your clock problems should go away!

      The other 'minor' problem you might have to live with, is that older 
versions of AT&T DOS have been known to use NON-STANDARD disk partitioning,
which means that if you are considering switching to a generic dos, be very 
carefull!  I STRONGLY urge you to do a FULL backup before attempting the
usually 'harmless' SYS C: command!

Good Luck...

                                              ---- Robb ----

--- FD 1.99c
 * Origin: Sir Hackalot's Lair (89:684/1)
--  
Robb Thomas - via IMEx node 89:681/1
Robb.Thomas@f1.n684.z89.onebdos.UUCP
uunet!van-bc!oneb!onebdos!!684!1!Robb.Thomas

gopstein@soleil.UUCP (Rich Gopstein) (06/01/90)

In article <1094.266605B1@onebdos.UUCP>, Robb.Thomas@f1.n684.z89.onebdos.UUCP (Robb Thomas) writes:

>       You should try booting your machine off floppy under a 'generic' 
> version of MS-DOS.  Next, run your clock utilities off the floppy, and POOF, 
> your clock problems should go away!
> 

I am using generic MSDOS, and am running my clock utility seperately
in autoexec.bat.  The problem is that after the machine boots it has the
correct time, but DOS time runs FASTER than real time.  If I wait a few
minutes, the DOS time is a few seconds ahead of wall-clock-time.

I pulled out the schematics for the 6300 last night, and armed with my
calculator, determined that the 6300's timer tick runs at 18.75 ticks/sec
instead of 18.2 as in a standard PC.  The easiest solution would be to
slow the timer down to 18.2 tick/secs, but the timer is already running
as slow as it can be set...  

The question is:  How can I get generic DOS (4.0 in my case), to keep
the correct time given the 18.75Hz clock rate?

Rich

-- 
Rich Gopstein

gopstein@soleil.nj.semi.harris.com
..!rutgers!soleil!gopstein

kaufman@delta.eecs.nwu.edu (Michael L. Kaufman) (06/02/90)

In article <980@soleil.UUCP> gopstein@soleil.UUCP (Rich Gopstein) writes:
>
>The question is:  How can I get generic DOS (4.0 in my case), to keep
>the correct time given the 18.75Hz clock rate?
>
>Rich Gopstein
>
>gopstein@soleil.nj.semi.harris.com
>..!rutgers!soleil!gopstein

The easiest way to do this is to write a little tsr that sets the clock ahead
a few seconds every minute.  I did not work out just how many seconds you 
will need to set it ahead, but it is easy to figure it out.

Michael Kaufman

mlord@bnr-rsc.UUCP (Mark Lord) (06/04/90)

In article <980@soleil.UUCP> gopstein@soleil.UUCP (Rich Gopstein) writes:
>
>I pulled out the schematics for the 6300 last night, and armed with my
>calculator, determined that the 6300's timer tick runs at 18.75 ticks/sec
>instead of 18.2 as in a standard PC.  The easiest solution would be to
>slow the timer down to 18.2 tick/secs, but the timer is already running
>as slow as it can be set...  
>
>The question is:  How can I get generic DOS (4.0 in my case), to keep
>the correct time given the 18.75Hz clock rate?

Well.. looks like a good application for writing a custom TSR.

You need some code to intercept the timer interrupts and cause every 34th
one to be skipped.  The more technically knowlegeable folks out there may
correct me, but my understanding is that the DOS "clock" is maintained in
software.  Some internal "clock" variables get incremented on each timer
interrupt, roughly 18 times per second (as you have found).  Since this 
interrupt is occuring too often, you need to write code to intercept this,
and NOT chain to other handlers on each 34th interrupt  
	18.75 / (18.75 - 18.20) = 34 (approx).

To avoid problems with other software that might chain to this interrupt,
it is probably best that this TSR be loaded LAST from the autoexec.bat file.
On second thought, maybe it would HELP other software.. in which case load 
it first! 

Have fun.
-- 
 ______Mark S. Lord______________________ ______________________________
|    ..uunet!bnrgate!carrsc!mlord        | These are only MY opinions.  |
| or:  bnr-rsc!mlord@bnrgate             | I charge for official views. |
|________________________________________|______________________________|

gopstein@soleil.UUCP (Rich Gopstein) (06/05/90)

Well,  it appears that generic DOS uses the CLOCK device for setting
and getting the current time.  I installed a CLOCK device that 
talks to the 6300's internal clock to set and get the time, so
it seems to be working now.  THe only problem is that the internal
clock ignores the seconds when being set.  So, if you set the time
at the start of a minute, everything works well.

Thanks for the help.

Rich Gopstein

-- 
Rich Gopstein

gopstein@soleil.nj.semi.harris.com
..!rutgers!soleil!gopstein

kaufman@delta.eecs.nwu.edu (Michael L. Kaufman) (06/06/90)

In article <3163@bnr-rsc.UUCP> mlord@bnr-rsc.UUCP (Mark Lord) writes:
>...
>You need some code to intercept the timer interrupts and cause every 34th
>one to be skipped.  

This could be quite dangerous.  You don't know what the timer tick is doing
besides updating the clock.  The system might (as one example) be using the
tick to control the drives.  Much safer is to update the clock, but don't do
it every 34 ticks.

Michael Kaufman