Mail Archives: djgpp/1998/01/30/00:17:41
From: | "John M. Aldrich" <fighteer AT cs DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: High speed timing
|
Date: | Fri, 30 Jan 1998 00:05:11 -0500
|
Organization: | Two pounds of chaos and a pinch of salt.
|
Lines: | 27
|
Message-ID: | <34D15F87.2D13@cs.com>
|
References: | <34D11CA2 DOT 79CD AT bellsouth DOT net>
|
NNTP-Posting-Host: | ppp229.cs.com
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Lester Davis wrote:
>
> What is the best way to get a time value between events. I'm getting
> ready to interface a sonar system to a pc and need to measure time of
> flight of the sonar. I don't want to use a simple counter. I'm sure
> there is a function that does what I need, any ideas?
clock() (defined in time.h) returns the elapsed time in CLOCKS_PER_SEC
since the first call to clock() in your program. uclock() (also defined
in time.h) returns the elapsed time in UCLOCKS_PER_SEC since the first
call to uclock() in your program. clock() is accurate to approximately
1/91 sec., while uclock() has a resolution of 1/1193180 seconds. Those
constants are also defined in time.h.
Be aware that uclock() may not be 100% accurate under Windows 95,
because it reprograms the system timer.
For more information, see the libc documentation for clock() and
uclock(), and look at the time.h header file.
--
---------------------------------------------------------------------
| John M. Aldrich |"A competent and self-confident person|
| aka Fighteer I | is incapable of jealousy in anything.|
| mailto:fighteer AT cs DOT com | Jealousy is invariably a symptom of |
| http://www.cs.com/fighteer | neurotic insecurity." - Lazarus Long|
---------------------------------------------------------------------
- Raw text -