diff --git a/ttfb b/ttfb index 0f9e49c..e5a84c9 100755 --- a/ttfb +++ b/ttfb @@ -65,6 +65,14 @@ for dependency in curl bc column; do which -s $dependency || (echo "You need to have '$dependency' installed and in your \$PATH" >&2 && exit 1) done +# Ensure curl uses period separators for floating point values, which +# bc requires to do calculations (i.e. it can't use locale separators like ,) +if (locale -a | egrep ^C.UTF-8$); then + export LC_ALL=C.UTF-8 +else + export LC_ALL=C +fi + # Cribbed from https://stackoverflow.com/a/41762669/391826 median() { arr=($(printf '%s\n' "${@}" | sort -n))