[Ilugc] program execution time

  • From: andyetitmoves@xxxxxxxxx (R.Ramkumar)
  • Date: Wed Jul 12 18:16:59 2006

This will not work.. i have tried time() function of C. It will not come up
to nanosecond precision because it returns time_t short int..
use clock function, it will give the processing time..or times() function..

What do you mean by `time' will not work? Every timing function has
it's precision, and for the function I gave, it was one second. The OP
had never given any idea of the precision needed, and hence I
preferred the most portable one. There are many other functions which
allow for more accurate representations but at the cost of
portability. for eg. many versions of FreeBSD do not conform to the
SUSv2 spec for the `clock' function you specified. Secondly,
representations upto a nanosecond (like struct timespec) never
guaranteed you a nanosecond precision. Various functions allow you to
get timing details as accurate as the OS can allow, but the precisions
reached are rarely to a nanosecond. These precision depend on the OS
and the hardware which form the clock sources for the OS.

it moves on...

-- 
April 1: This is the day upon which we are reminded of
what we are on the other three hundred and sixty-four.
          -- Mark Twain, "Pudd'nhead Wilson's Calendar"

Other related posts: