delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2008/03/27/10:50:20

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
From: "Gerrit van Niekerk" <gerritvn AT gpvno DOT co DOT za>
Organization: GPvNO
To: djgpp AT delorie DOT com
Date: Thu, 27 Mar 2008 15:04:04 +0200
MIME-Version: 1.0
Subject: Strange behaviour of clock() function
Message-ID: <47EBB764.17357.14C9089@gerritvn.gpvno.co.za>
X-mailer: Pegasus Mail for Windows (4.41)
Reply-To: djgpp AT delorie DOT com

The clock() function sometimes goes haywire and I isolated the problem to 
the fact that the _farpeekl(_dos_ds, 0x46c) function sometimes returns a 
value one less than during a previous invocation of clock(). This is then 
interpreted as a "midnight passed" event with disastrous effect on the value 
returned. 

I have only seen it happen when Real Mode Callbacks are also being used. 
One event triggering the RMCB is an Int 1cH interrupt. The RMCB function 
does not call clock(). The environment is ROM-DOS and CWSDPMI.

An explanation of why this happens would be appreciated. In the meantime I 
have solved the problem by testing for a small number of ticks going back in 
time and just ignoring that value, but I would rather fix the problem than the 
symptom.



- Raw text -


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