/* Returns the time in seconds used by the process. The system call is getrusage(2), which returns a structure containing various pieces of resource usage information. */ /*********************************************************************/ #include #include #include #include double second_() { static struct rusage temp; double foo, foo1; getrusage(RUSAGE_SELF,&temp); foo = temp.ru_utime.tv_sec; /* seconds */ foo1 = temp.ru_utime.tv_usec; /* uSecs */ return foo + foo1 / 1000000.0 ; }