On Fri, Aug 30, 2002 at 08:34:33AM -0500, Mike Bresnahan wrote:
> Is there a high resolution timer C API on Linux?  If so, what is it's
> name?  I need a timer that will give me time with a precision better
> than seconds, e.g. milliseconds.  I'm looking for a C function
> equivalent to the Java function System.currentTimeMillis() and the
> Win32 functions QueryPerformanceCounter() and
> QueryPerformanceFrequency.

gettimeofday has a potential resolution down to microseconds.  Its
actual resolution may vary.  Under Windows, for example, the actual
resolution of System.currentTimeMillis() is 1/10th of a second.

The reason I know this is that somebody tried to base a unique filename
off of the time in milliseconds, and it failed more often than one might
expect.  I changed it to use as much of an MD5 hash of the file as it
could chew through in 8 seconds, plus the time.  The chance of collision
there should be somewhere close to 2^-90 or so.

Have fun (if at all possible),
-- 
"It does me no injury for my neighbor to say there are twenty gods or no God.
It neither picks my pocket nor breaks my leg."  --- Thomas Jefferson
"Go to Heaven for the climate, Hell for the company."  -- Mark Twain
-- Eric Hopper (hopper at omnifarious.org  http://www.omnifarious.org/~hopper) --
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://shadowknight.real-time.com/pipermail/tclug-devel/attachments/20020830/dd80ffa9/attachment.pgp