also more portable by removing non-standard nanoseconds
still uses clock in microseconds
Description
This is now pure bash. It might improve performance slightly by reducing syscalls to sleep and date.
Also only GNU date supports %N (nanoseconds), so it would have broken on BSD or other platforms that only support strftim(3) proper. The only drawback is internal printf %(datefmt)T supports only standard strftim(3) so we must use microseconds instead of nano.
Contributing requirements
[x] I read the contribution guidelines in CONTRIBUTING.md.
[x] I placed my solution in the correct solution folder.
[x] I added a README.md with the right badge(s).
[x] I added a Dockerfile that builds and runs my solution.
[x] I selected drag-race as the target branch.
[x] All code herein is licensed compatible with BSD-3.
Description
This is now pure bash. It might improve performance slightly by reducing syscalls to
sleep
anddate
.Also only GNU
date
supports%N
(nanoseconds), so it would have broken on BSD or other platforms that only supportstrftim(3)
proper. The only drawback is internalprintf %(datefmt)T
supports only standardstrftim(3)
so we must use microseconds instead of nano.Contributing requirements
drag-race
as the target branch.