bats-core
bats-core copied to clipboard
get_mills_since_epoch() broken on freebsd
Describe the bug
FreeBSD's date command does not support the %N option to get milli-micro-nanoseconds. All timings for tests are rounded to a second.
To Reproduce
Run tests, see times reported as [0] [1000] [2000] instead of [234] [1550] [2349]
Environment (please complete the following information):
Any version of freebsd.
Additional context
By installing the "coreutils" package and using gdate instead of date, the times are reported correctly.
On freebsd, $(date +%N) = "N", and in this case, we may want to call gdate if available.
I think we should rely on $EPOCHREALTIME when available and fall back to (g)date if necessary.