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?
Asked
Active
Viewed 2,707 times
15
Kevin
- 40,767
Łukasz Sowa
- 521
1 Answers
18
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.
Kevin
- 40,767
Łukasz Sowa
- 521
time", I assume you mean BSDtimeas that usesgetrusage. – Dennis Feb 03 '17 at 17:48