delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/02/13/09:37:44

Subject: uclock() counts down?
MIME-Version: 1.0
Date: Thu, 13 Feb 2003 09:40:40 -0500
X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0
content-class: urn:content-classes:message
Message-ID: <795DD3C2E97585449DCDEEE79CCD5C22BA8C@email2k.compuweigh.com>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Thread-Topic: uclock() counts down?
Thread-Index: AcLTbeCJbgX3oFgWRB+refcyE/MnxA==
From: "Alex O" <Alex AT compuweigh DOT com>
To: <djgpp AT delorie DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id h1DEbIZ28491
Reply-To: djgpp AT delorie DOT com

Hi everybody,

I have noticed a strange behavior with uclock() in my program and was just wondering if there is a rational explanation to that.
After some recent changes in the application I have noticed that the time-dependent values on my real-time graphs may flow backwards! I use uclock() to time the change of certain parameters, because they are too fast for clock() (60-100 times per second), and monitoring the return values of uclock() I saw that it in fact may sometimes return smaller values than before for a few calls in a row!
After about a day digging through the code I finally found this strange piece of code:

uclock();
...
inportb(0x40);

which causes this odd behavior. If reading from the port 0x40 (system's timer register) is commented out or placed before the uclock(), everything works OK.

Any thoughts why?

Alex O.

- Raw text -


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