Close GH-65: Use $EPOCHSECONDS.. Fixes #64

This commit is contained in:
Stephen Blott
2014-04-17 23:04:52 +02:00
committed by Sindre Sorhus
parent 2dc383e69d
commit de623b5b34

View File

@@ -43,14 +43,14 @@ prompt_pure_git_dirty() {
# displays the exec time of the last command if set threshold was exceeded # displays the exec time of the last command if set threshold was exceeded
prompt_pure_cmd_exec_time() { prompt_pure_cmd_exec_time() {
local stop=$(date +%s) local stop=$EPOCHSECONDS
local start=${cmd_timestamp:-$stop} local start=${cmd_timestamp:-$stop}
integer elapsed=$stop-$start integer elapsed=$stop-$start
(($elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5})) && prompt_pure_human_time $elapsed (($elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5})) && prompt_pure_human_time $elapsed
} }
prompt_pure_preexec() { prompt_pure_preexec() {
cmd_timestamp=$(date +%s) cmd_timestamp=$EPOCHSECONDS
# shows the current dir and executed command in the title when a process is active # shows the current dir and executed command in the title when a process is active
print -Pn "\e]0;" print -Pn "\e]0;"
@@ -98,6 +98,7 @@ prompt_pure_setup() {
prompt_opts=(cr subst percent) prompt_opts=(cr subst percent)
zmodload zsh/datetime
autoload -Uz add-zsh-hook autoload -Uz add-zsh-hook
autoload -Uz vcs_info autoload -Uz vcs_info