C machine

Richard Tobin richard at aiva.ed.ac.uk
Sun Jan 31 05:47:01 AEST 1988


In article <1131 at jenny.cl.cam.ac.uk> am at cl.cam.ac.uk (Alan Mycroft) writes:
>Even more problematic:  has anyone on the ANSI committee tried
>writing a STRICTLY CONFORMING program which accurately prints cpu time
>(a la clock()) to a file (say in centi-secs or to 2 decimal places)?
>Perhaps printf("%t", (time_t)...)?
>The trouble is that time_t may be either integral or floating.

Hmmm... I haven't got a standard handy, so maybe I'm missing something,
but how about:
	
	int time_is_floating;
	time_t t;

	time_is_floating = (t = 1.5, t > 1);

	if(time_is_floating)
	    ....

Ok, so it's a hack.

-- 
Richard Tobin,                         JANET: R.Tobin at uk.ac.ed             
AI Applications Institute,             ARPA:  R.Tobin%uk.ac.ed at nss.cs.ucl.ac.uk
Edinburgh University.                  UUCP:  ...!ukc!ed.ac.uk!R.Tobin



More information about the Comp.lang.c mailing list