Currently in my BASH script I have the following which measures how long a command takes to execute in seconds.
eval $line /dev/null 2>&1
DIFF=$(( $END - $START ))
I wanted to make this more accurate, I am trying to use:
int gettimeofday ( struct timeval * tv , struct timezone * tz )
which i read from another thread on LQ
, but being a noob I don't know how to use it!
How do I replace START and END with the above function?
I don't really need all that timezone etc, all I need is just seconds and milliseconds and minutes. Not sure how accurate of gettimeofday is?
Would appreciate any help and explanation.