www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2005/10/08/15:34:42

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
From: "Gerrit van Niekerk" <gerritvn AT gpvno DOT co DOT za>
Organization: GPvNO
To: djgpp-workers AT delorie DOT com
Date: Sat, 08 Oct 2005 20:01:53 +0200
MIME-Version: 1.0
Subject: Clock problems under Win2k/XP
Message-ID: <434825B1.21624.39826EBB@localhost>
X-mailer: Pegasus Mail for Windows (4.21c)
Reply-To: djgpp-workers AT delorie DOT com

I recently encountered program hangups under WinXP and traced it to the 
BIOS timer tick accessed by _farpeekl(_dos_ds, 0x46c) not advancing 
unless BIOS is actually called. 

Scanning through the archives I encountered a number of messages 
about irregular timer ticks and quite complex ways like RDTSC to resolve 
it. I believe many of them can be simply solved by calling BIOS. The 
following function illustrates my point:

int GetTick(void)
{
   __dpmi_regs r;

    r.h.ah = 0x11;	// check keyboard status and ignore result
    __dpmi_int(0x16, &r);
   return  _farpeekl(_dos_ds, 0x46c);
}

Having to do a BIOS call anyway, one can probably just use the BIOS call 
to get the ticks directly using Int 0x1a, Function 0. I very much doubt that 
the midnight passed flag will influence Win2K/XP.

Note that the clock() function in LIBC suffers from the same problem.

===============================================
Gerrit van Niekerk
GP van Niekerk Ondernemings BK
Roosstraat 211, Meyerspark, 0184, South Africa
Tel: +27(12)8036501 Fax SA: 0866 413 555
Fax Int'l: +12(06)2034131
Email: gerritvn AT gpvno DOT co DOT za
Web: http://www.gpvno.co.za
===============================================

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019