X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Andris Pavenis To: djgpp AT delorie DOT com Subject: Re: Timer inside interrupt handler Date: Mon, 25 Oct 2004 19:37:11 +0300 User-Agent: KMail/1.7.1 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200410251937.11224.pavenis@latnet.lv> Reply-To: djgpp AT delorie DOT com On Saturday 23 October 2004 23:15, Jason Mills wrote: > Does anyone have any suggestions as too what time functions > can be safely called inside an interrupt handler? I > need something with a resolution of > 80ms. Basically, > I need a time stamp of when the IRS is called. > > I used uclock() originally, but I think it's causing > some problems in other parts of my code. I'm aware of the > other timing functions, but which one is "safest" to call > inside the ISR? Is there a better way to get a time stamp > inside an ISR then calling something like uclock(). If You are using CPU which supports rdtsr instruction (Intel Pentium and above and some others support), then try to use it. Of course You need to know CPU clock frequency, but normally it's not difficult to get. Andris