title: Use PS0 and PS1 to display execution time of each bash command
body: <p>It seems that by executing code in PS0 and PS1 variables (which are eval'ed before and after a prompt command is run, as I understand) it should be possible to record time of each running command and display it in the prompt. Something like that:</p>
  
  <pre><code>user@machine ~/tmp
  $ sleep 1
  
  user@machine ~/tmp 1.01s
  $
  </code></pre>
  
  <p>However, I quickly got stuck with recording time in PS0, since something like this doesn't work:</p>
  
  <pre><code>PS0='$(START=$(date +%s.%N))'
  </code></pre>
  
  <p>As I understand, <code>START</code> assignment happens in a sub-shell, so it is not visible in the outer shell. How would you approach this?</p>