[plugins/runtime] Don't depend on bc

Signed-off-by: Olivier Mehani <shtrom@ssji.net>
This commit is contained in:
Olivier Mehani 2018-06-12 08:29:25 +10:00
commit dbe6daf1f5
No known key found for this signature in database
GPG key ID: ADCF72E06DBC3057

View file

@ -8,7 +8,8 @@ local _RUNTIME_FILE=$(umask 7077; mktemp /tmp/zsh_runtime.$$.XXXXXX)
function runtime() {
local last=$(cat ${_RUNTIME_FILE} 2>/dev/null)
if [[ -n $last ]]; then
echo "$(date '+%s')-$last" | bc -ql
now=$(date '+%s')
echo "$((now-last))"
echo > ${_RUNTIME_FILE}
fi
}