www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/12/20/17:17:57

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: tupdegrove AT agere DOT com (Tim Updegrove)
Newsgroups: comp.os.msdos.djgpp
Subject: Alternative approach for uclock
Date: 20 Dec 2001 14:14:34 -0800
Organization: http://groups.google.com/
Lines: 27
Message-ID: <98cd06c8.0112201414.492036f1@posting.google.com>
NNTP-Posting-Host: 192.19.194.27
X-Trace: posting.google.com 1008886475 9078 127.0.0.1 (20 Dec 2001 22:14:35 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 20 Dec 2001 22:14:35 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Background: I use uclock() to provide short delays between polling
hardware and also to provide a max amount of time to wait for the
hardware event to occur.  This has worked fine when the program ran in
under 30 seconds or so.  A DOS batch file was used to restart the
program to run on different hardware each time (there is an initial
wait for the hardware to be swapped).

I'd like to change the program to continue running (for days) without
restarting the program from the batch file.  I'm worried about the
value of uclock() wrapping since the documentation mentions 60 minutes
for 32 bits and 24 hours for 64 bits.  Specifically, after the program
has run a while and the wrap value is near, the 2nd call to uclock()
could be less than the 1st call.

I'm looking for ideas on how to solve this problem.  I've thought of:
(1) spawning a program whenever a starttime/endtime calculated from
uclock() is needed.  Functionally, this may work (the static value
would get zeroed) but, since there are thousands of calls to uclock(),
the program may be too slow.  I'm new to spawning.  Can I spawn the
program once for one test pass (30 seconds) so that access may be
faster?  Use a different option than P_WAIT?

(2) Try to use a variable to count the number of wraps?  This sounds
awfully messy.

(3) Duplicate the uclock() function to provide a method to zero the
static variable (somehow) after one test pass?

- Raw text -


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