Append this to your ~/.zshrc file.
function preexec() {
timer=$(($(date +%s%0N)/1000000))
}
function precmd() {
if [ $timer ]; then
now=$(($(date +%s%0N)/1000000))
elapsed=$(($now-$timer))
export RPROMPT="%F{cyan}${elapsed}ms %{$reset_color%}"
unset timer
fi
}
Remixed from @adri's snippet.
here is my idea of a simple prompt with random colors and also a slightly modified way of showing the numbers, having a 2 part place holder prompt when starting zsh and a 3 part prompt with elapsed time, also includes black and white part for error-ed out commands
had some help from here for making the random colors in the function part of the prompt work