times() is good within an particular (unix-ish) environment,
but generally gives you clock ticks. Unfortunately
those clock ticks may vary for different hardware and
for different OSes depending on the jiffy (quantum) size,
the CPU speed, and the power saving facilities...
Don't get me wrong, it's still probably a 99% solution
to what you were trying to do.