From: James Courtier-Dutton <James@superbug.co.uk>
To: linux-msdos@vger.kernel.org
Subject: [Patch] Fix DOS get time function.
Date: Fri, 16 Nov 2007 02:56:32 +0000 [thread overview]
Message-ID: <473D06E0.1030507@superbug.co.uk> (raw)
[-- Attachment #1: Type: text/plain, Size: 281 bytes --]
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: James@superbug.co.uk
James
[-- Attachment #2: time-fix.diff --]
[-- Type: text/x-patch, Size: 561 bytes --]
--- src/dos/dos.cpp.org 2007-11-16 02:46:35.000000000 +0000
+++ src/dos/dos.cpp 2007-11-16 02:54:50.000000000 +0000
@@ -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);
next reply other threads:[~2007-11-16 2:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-16 2:56 James Courtier-Dutton [this message]
2007-11-19 22:44 ` [Patch] Fix DOS get time function Bart Oldeman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=473D06E0.1030507@superbug.co.uk \
--to=james@superbug.co.uk \
--cc=linux-msdos@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox