nojhan/liquidprompt — pull request #200 by mrks (2013-06-12 11:32:19+00:00)
Title: Added runtime displaying

This patch adds a field that displays the runtime of the last command. Enable the feature with `LP_ENABLE_RUNTIME=1` in your config. Only runtimes over two seconds are displayed - use `LP_RUNTIME_THRESHOLD` to change this value.

Example:

[:~] $ sleep 1
[:~] $ sleep 2 # prompt unchanged because the threshold is set to 2 seconds
[:~] 2s $ sleep 1 && sleep 2 # runtime of 2 seconds displayed
[:~] 3s $ # runtime of chain correctly displayed

- As of now, bash only. It would be great if someone could port it to zsh
- The time displayed is the real time elapsed (wall time).
- As this uses the unix timestamp in seconds, an error of up to one second is possible.
- Doesn't use time(1) but the bash internal timestamp, so no additional processes are spawned and the overhead is minimal
- The runtime of chains (see line 3 in the example above) is correctly measured - this is different from e.g. `time sleep 1 && sleep 2`
- Unlike other solutions, this one does not overwrite $SECONDS