new stopwatch as function, tested in bash and zsh