Today I was looking at some building tools and they often print the time they take to do something. I wanted to add this feature to the configure-script.
It turns out to be very easy, just using the date
command bring us the elapsed time. There’s just a little detail, BSD date
behaves a bit differently from GNU date
. More precisely BSD doesn’t have the %N
format for nanoseconds. We just need to check if the system uses a BSD date
or a GNU one
This is more like a note to myself but it may be usefull for someone one day :)