Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

The buitin bash command time gives milisecond precision of execution and GNU time (usually /usr/bin/time) gives centisecond precision. The times(2) syscall gives times in clocks, and 100 clocks = 1 second (usually), so the precision is like GNU time. So the question is what is bash time using so that it's more precise?

share|improve this question
Hmmm... they both give milliseconds on my system... (FC16) –  nico Dec 29 '11 at 17:44
Strange. What gives you printf("%d\n", sysconf(_SC_CLK_TCK)); should be 100 as I stated above. Someone have similar observations to mine: but still no explanation. –  Łukasz Sowa Dec 29 '11 at 17:48
yes, in effect it gives 100... –  nico Dec 29 '11 at 18:01
Then I have no idea why's that. GNU time is supposed to use times syscall which uses sysconf(_SC_CLK_TCK) to convert to seconds. –  Łukasz Sowa Dec 29 '11 at 18:24

1 Answer 1

up vote 11 down vote accepted

After some hardcore bash code examining I found out that bash time uses getrusage() and GNU time uses times(). getrusage() is far more precise because of microsecond resolution.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.