The time command returns the time elapsed in execution of a command.
If I put a "gettimeofday()" at the start of the command call (using system() ), and one at the end of the call, and take a difference, it doesn't come out the same. (its not a very small difference either)
Can anybody explain what is the exact difference between the two usages and which is the best way to time the execution of a call?
Thanks.
time()
is a terrible idea. It only counts seconds, whilistgettimeofday()
can return microseconds. – Clockmakertime
refers to the C library function, or the shell command? And could you give examples of the difference you're seeing? – Monoacid