[comp.std.c] Need help with defining time

westphal@IDA.ORG (Christopher Westphal) (03/22/90)

I recently purchased a copy of Turbo C, for a 286 IBM.

After reviewing the manuals, I can't find how to get time
intervals in the millisecond range. There is a header file
that can be used with Unix, but does me no good.

So...if anyone knows how to get time in milliseconds, please
let me know!!!

Thanks in advance
 Chris

ccplumb@lion.waterloo.edu (Colin Plumb) (03/22/90)

In article <1990Mar21.195807.13318@IDA.ORG> westphal@IDA.ORG.UUCP (Christopher Westphal) writes:
>I recently purchased a copy of Turbo C, for a 286 IBM.
>
>After reviewing the manuals, I can't find how to get time
>intervals in the millisecond range. There is a header file
>that can be used with Unix, but does me no good.
>
>So...if anyone knows how to get time in milliseconds, please
>let me know!!!

The most accurate time provided by ANSI C is from the function
clock(), which returns the number of CLOCKS_PER_SEC ticks of
processor time (in the case of an IBM clone running single-user,
elapsed time) used by the process.  If CLOCKS_PER_SEC is less than
1000 (I suspect it's something like 18.2) on your implementation,
the ANSI C standard can't help you, sorry.

Your implementation may also define the return value from time()
(unspecified in the standard) in a useful way.

These are (as far as I understand the Decmeber 7, 1988 draft I'm using; 
other greater experts may correct me) the only standard C functions for
obtaining the time.  Your implementation may provide nonstandard ways
to obtain more accurate timings.  Try asking comp.sys.ibm.pc.
-- 
	-Colin