3 ms·
Looks like you probably also have SHARE_HISTORY set? [1] [1] https://unix.stackexchange.com/questions/396809/zsh-share-history-or-inc-append-history-breaks-ext
by cb321 6y ago
Looks like you probably also have SHARE_HISTORY set? [1]
[1] https://unix.stackexchange.com/questions/396809/zsh-share-history-or-inc-append-history-breaks-extended-history https://unix.stackexchange.com/questions/396809/zsh-share-hi...
- jolmg 6y agoIn my case, I have INC_APPEND_HISTORY enabled. It appears I get 0 in the duration column because it's writing to the history file before executing the command. I see there's the alternative option INC_APPEND_HISTORY_TIME to append to history after the command finishes in order to include the duration. It makes sense. It's preferring to add to history immediately so that it's available to other shells without having to wait for the command to finish. From the manpage: > INC_APPEND_HISTORY_TIME This option is a variant of INC_APPEND_HISTORY in which, where possible, the history entry is written out to the file after the command is finished, so that the time taken by the command is recorded correctly in the history file in EXTENDED_HISTORY for‐ mat. This means that the history entry will not be available immediately from other instances of the shell that are using the same history file. This option is only useful if INC_APPEND_HISTORY and SHARE_HISTORY are turned off. The three options should be considered mutually exclusive.
- cb321 6y agoHah. @jolmg & I almost collided to the second. :-) That stackexchange link had an answer with the INC_APPEND_HISTORY_TIME setopt which seems to work without SHARE_HISTORY (I think using his whole stackexchange answer might still result in 0s..at least it did for me when I ran it in a precmd() instead of adding the hook, but it could always be something else varying between his & my setopts).