[net.micro.pc] MSDOS 2.0 clock problems

Info-IBMPC@USC-ISIB.ARPA (10/01/84)

From:  Info-IBMPC Digest <Info-IBMPC@USC-ISIB.ARPA>

From: <bang!crash!bblue@Nosc>
Date: Fri, 28 Sep 84 22:47:46 pdt
Subject: MSDOS 2.0 clock problems
To: info-ibmpc@usc-isib

Lauren - I have seen explanations for the date rollover problem in several
publications and have fixed it in a couple of ways.  The best explanation I
have found for this appeared in the May 1 issue of PC Magazine in the PC
Tutor section, page 415.  I'll paraphrase here:

	...Apparently this is what happens.  When the time rolls
	over at 24:00, the timer interrupt routine sets an
	overflow flag in memory at 0040:0070.  When you call the
	time-of-day routine (INT 1Ah) to read the time, this
	routine resets the overflow flag to zero.
	   The time-of-day routine returns the overflow flag in
	the AL register.  When the DATE program calls on this
	routine, DATE is smart enough to increment the date when
	it finds the overflow flag on.
	   The disk-dirver routines that are in the DOS (not in
	the BIOS) also use the time-of-day clock.  They might
	use it to time out the disk drive appropriately or to
	check for read errors.  Unfortunately, these routines do
	not change the date to the next date even though they are
	told that the overflow flag is set.  And once these
	routines are run, the overflow flag is reset to zero.
	If this happens before you ask for the date, the DATE
	routine won't be told to change to the next day.
	   This certainly is a bug!  And there's no simple way
	to fix the software.  The simplest answer might be to
	create a new clock driver for PC-DOS 2.0 that does two
	things:
	   First, the driver must substitute a new routine in
	place of the time-of-day interrupt routine (INT 1Ah).
	This new routine would not reset the overflow flag
	unless the routine was called with an argument of 2.
	(Presently, there are only arguments of 0 for setting
	the flag and 1 for reading it.)  Thus AH=2 would involve
	reading the clock and also resetting the overflow flag.
	   Second, when the new clock driver is called for
	reading the time or date, it will call the new
	time-of-day routine with an argument of 2.  Hence, the
	overflow flag will be reset only when a program is
	called that is able to change the date....

I have seen a public domain driver called CLOCKFIX.SYS (with an
associated .DOC file) that apparently does something similar.  It seems
to work.

Hope this helps.        --Bill Blue     {ihnp4, sdcsvax!bang}!crash!bblue

-------