Need help with defining time

Colin Plumb ccplumb at lion.waterloo.edu
Thu Mar 22 12:50:49 AEST 1990


In article <1990Mar21.195807.13318 at IDA.ORG> westphal at 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



More information about the Comp.std.c mailing list