Skip to contentSkip to conversation

Fix DOS get time function.

PATCH In review James Courtier-Dutton 2 participants 2 messages Nov 16, 2007 – Nov 19, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix DOS get time function.

Hi,

The current DOS INT 21 AH=2C get time function returns incorrect results, and is sometimes hours off. The attached patch fixes the problem.
It should patch against DOSBOX 0.72
the (X * 500 / 91) is the same as X * 100 / 18.2

Signed-off-by [email protected]

James

dos/dos.cpp renamed from dos/dos.cpp.org +3 -2
@@ -348,8 +348,9 @@
 //TODO Get time through bios calls date is fixed
 		{
 /*	Calculate how many miliseconds have passed */
-			Bitu ticks=5*mem_readd(BIOS_TIMER);
-			ticks = ((ticks / 59659u) << 16) + ((ticks % 59659u) << 16) / 59659u;
+			/* seconds = ticks / 18.2 */
+			Bitu ticks=500 * mem_readd(BIOS_TIMER);
+			ticks = ticks / 91;
 			Bitu seconds=(ticks/100);
 			reg_ch=(Bit8u)(seconds/3600);
 			reg_cl=(Bit8u)((seconds % 3600)/60);
#1 lore raw
Quoted 5 lines · James Courtier-Dutton

The current DOS INT 21 AH=2C get time function returns incorrect results, and is sometimes hours off.
The attached patch fixes the problem.
It should patch against DOSBOX 0.72
the (X * 500 / 91) is the same as X * 100 / 18.2

Hi James,

I'm afraid you were emailing the wrong list (dosemu): dosbox has its own forum and sourceforge trackers.

Bart