delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/09/30/17:25:20

From: Nigel Stephens <nigel AT algor DOT co DOT uk>
Date: Fri, 30 Sep 94 18:09:13 +0100
To: Long Doan <ldoan1 AT mason1 DOT gmu DOT edu>
Cc: "Victor K. Chu" <victor AT euler DOT Berkeley DOT EDU>, DJGPP AT sun DOT soe DOT clarkson DOT edu
Subject: Re: accuracy of clock()
References: <199409300439 DOT VAA18364 AT euler DOT Berkeley DOT EDU>
<Pine DOT 3 DOT 89 DOT 9409300741 DOT A10191-0100000 AT mason1 DOT gmu DOT edu>

Long Doan (ldoan1 AT mason1 DOT gmu DOT edu) writes:
 > > I wonder if anyone knows that there is any way to get a more
 > > accurate time?
 > 
 >   There is one way to do it through reprogramming the timer chip. This 
 > also requires modification (replacement) of the DOS Interrupt 8 so that 
 > the DOS clock is properly updated. This method is presented clearly in 
 > Intel manuals.

If you do not actually need more frequent interrupts, but just want to
accurately read the elapsed time, then another way to do it might be
to leave the timer interrupting at 18.2Hz, but read the timer's count
register.  By doing this you can calculate how many microsecs have
passed since the last interrupt, and add that to the interrupt count.

Regards

 _________________________________________________________________________
 Nigel Stephens, Algorithmics Ltd, 3 Drayton Park, London, N5 1NU, England
 phone: +44 71 700 3301    fax: +44 71 700 3400   email: nigel AT algor DOT co DOT uk

- Raw text -


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